How can add custom commands in post-new.php in wordpress

You could run this code inside of an action on transition post status. Any time a post is published you could run this code to generate and upload the HTML to your FTP server.

function post_published( $new_status, $old_status, $post ) {
    if ( $new_status == 'publish' ) {
        // Build your file and upload it
    }
}
add_action( 'transition_post_status', 'post_published', 10, 3 );