Push Button Activated While Loop

I want to write a while loop that gets activated and runs only once when I press a push button connected to a digital pin; something like "wait for push button and when activated do the rest".

A while loop says to do something over and over, until a condition is met. It is not intended for a one-time operation. An if statement is.

You probably want to consider doing something only when the transition from released to pressed occurs, not just if the switch is pressed. If you hold the switch down, should the task, whatever it is, be repeated until the switch is released, or should it be done just once?

If it is to be done just once, you need to keep track of the previous state of the switch, so that you can detect the transition (the current state does not match the previous state). The current state then defines whether the transition was pressed-to-released or released-to-pressed.