How to start a stepper motor with a push button, but stop it on its own

Hello @wow39 ,

welcome to the Arduino-Forum.

you should read this and take it into your heart.

to be as shortworded like you

you use a library for stepper-motors that offers background step-pulse-creation.
This hsort answer does not help very much - I know.

A stepper-motor driven by the stepper.h-library needs a step-pulse for each step the stepper-motor shall do. Otherwise you would have no control over the stepper-motor.

This means you have to let void loop looping for 20 seconds.
This requires non-blocking timing which is described here.

best regards Stefan