Your program is not using a flag.
The purpose of the flag is to stop the circuit retriggering after the first output, until the switch is released.
This involves checking the button is pressed AND the flag is false before you enable the output.
You only reset the flag once the button is read.
Weedpharma