How to disable Publish button on Edit post if post title exists

You can achieve this by adding post.php to your conditional check before enqueuing your script.

NOTE: This might effectively disable the ability to update posts.

add_action('admin_footer', function() { 
    global $pagenow;

    if ( !$pagenow || !in_array($pagenow, array( 'post-new.php', 'post.php' )) )
        return; // only enqueue when writing/editing posts
    ?>
    <script>
        jQuery(document).ready(function($){
            $(document).on("change", "#titlediv #title", function(e){
                var i = $(this)
                  , f = i.closest('form')
                  , t = i.val()
                  , b = $('input[name="publish"]', f).first();

                if ( self.xhr ) {
                    self.xhr.abort();
                } else {
                    var xhr;
                }

                if ( !b.length ) return;
                b.attr('disabled','disabled');

                if ( $.trim( t ) ) {
                    self.xhr = $.ajax({type: 'post', url: 'admin-ajax.php', data: {
                        action: 'check-posts-by-title',
                        title: t
                    }, success: function(res){
                        if ( res && res.enable_btn ) {
                            b.removeAttr('disabled');
                        } else {
                            if ( res.message ) {
                                alert(res.message);
                            }
                        }
                    }, error: function(){
                        i.trigger('change'); // roll over
                    }});
                }
            });
            $('#titlediv #title').trigger('change');
        });
    </script>
    <?php
});