The servo will stop moving when you stop telling it to move.
At the moment, your code checks the button, and if it's pressed, starts the whole moving routine, without checking again until the routine is finished.
The servo will stop moving when you stop telling it to move.
At the moment, your code checks the button, and if it's pressed, starts the whole moving routine, without checking again until the routine is finished.