How to stop continuously servo with push button

i posted code that works on an arduino. just change the pin appropriately

doubt multi-tasking is necessary