Hello,
I didn't understand if you are having problems with creating the local variable or getting an error due to it.
But I'll explain what I think you must do in order to do what you want...
First right click in the button or in the terminal and choose create local variable.
Then use it in your code to stop all your loops.
Now you should have a broken arrow, meening that you cannot have local variables of buttons with latch mechanical actions.
Go to the front panel, right click on your button and choose mechanical action.
Thne choose one of the non latch, normally the first one. But from now on, you have a switch, meening that it will not go from true to false automaticaly, you press it once it goes to true and then, when you press it again, it goes from true to false.
So you have to do this yourself. at the end of the while loops, wire a false to a local variable of the button so you can use it in the next iteration.
Note that this is some strange programming, normally you should use some event structures to control your user interaction.
Hope this helps,
Paulo