What Potis said. You can't call A_M() from Main(), then call Main() from A_M(), and so on. Every call would (assuming the interpreter let you do recursive calls) just add another program to the call stack until it overflowed. You could have a stack of umpteen copies of Main() and A_M() running on top of each other like a multi-decker sandwich. You want to keep the sandwich small enough to fit in your mouth (so to speak).
You could use an EXIT command at the bottom of A_M(), or do something like:
DEF AUTOMATIC_MODE()
PTP HOME
WHILE AUTOMATIC_MODE
;stuff
ENDWHILE
END
This way, A_M() will hit its END statement at the end of the cycle during which AUTOMATIC_MODE goes False. But to go back to a higher-level program from a sub-program that it called, don't use a call, use a RETURN or, better, simply let the sub-program reach its natural end.