I cannot seem to get to the end of a scene without wanting to edit it, and it affects how my story progresses. How can I stop myself doing this?
It doesn't matter if it's rubbish, or if you think it's rubbish, just finish the scene and keep going until you finish the script. If you've come to a mental block, write something that finishes the scene (even if it's 'MORE DIALOGUE/BANTER HERE AND JOHN STORMS OUT THE PUB', e.g). Try planning out the story beforehand, if you're not already, and that should keep you going, or give you the opportunity to move to a different sequence and come back to that troubling scene/sequence later.
But it's all about just finishing it. Keep going, keep writing, and you'll get there. Rewrite/edit later.