the name of function "loop" does what the name says:
It loops. Always. For ever. Infinitely. (As long as power is switched on)
As long as the for-loop runs the only code that is inside the for-loop is executed.
This is called blocking code.
You need NON-blocking code.
And this means zero while-loops, zero for-loops.
The only loop that is looping is
void loop() itself