i posted some code showing the use of a state to sequence the motors that is captured in a sub-function, funcA(), called from loop(). i did it that way thinking this is one mode of operation and that it could conditionally be called from loop() depending what mode you want to be in (may need a way to reset state).
so you can create other sub-functions for other modes of operation. They can also use state variable to sequence the motors.
And you have yet additional state variables to determine what mode you're in that are used in loop() to determine which sub-function to call.
loop() would also have code to read buttons, a sub-function that monitors for button state changes and returns a button press which loop() would use to determine which mode of operate to exercise (which sub-function to call), including one to stop everything.
just break everything into testable pieces and put the piece together to create a system.