How Do I prevent my Mac from sleeping while the KM macro is running

Since this is a new question, it would be better asked in a new topic.

You can use the shell tool /usr/bin/caffeinate to tell the Mac not to sleep (either sleep, or display sleep, or whatever).

The tool has to continue running while it holds this state, so you will have to figure out how to keep it running until the process continues. It can run while a subtool runs, so you could write a subtool that kept running until poked by Keyboard Maestro for example. Or you can just keep running it in the background periodically through the process.