button to run loop once then await button press

When you first close the switch 'set' a flag variable.
When the flag variable is set, run your code then 'reset' the flag variable.

Study the 'state change' example in the IDE.

delay(10000); <——<<<< don’t use delay()