Suggestions for using arduino mega to power multiple devices

You cannot use a Mega or any Arduino board to power any but the tiniest of motors, Arduino boards are micro-controller, not power supplies. You need an appropriate power supply for the motor. Your Mega is more than capable of controlling the motor.

If you provide details of the motor someone will most likely suggest a suitable power supply.

As for the bit about repeating things, this is basic programming. If you don't know how to do it then work through the tutorials on this web site, in the Arduino IDE and elsewhere. Make an attempt at what you want to do and post your code in line with the forum instructions How to get the best out of this forum . If you make a decent attempt and get stuck someone will help.

Lots of people had done similar projects to you and had help here, probably the best place to start is by reading through existing questions and answers in this section of the forum.