OK, I solved my problem.
First, I misunderstood the error and thought the line number referred to the macro.
Then I was racking my brains about what was wrong with my !insertmacro command.
Turns out, the only thing wrong with it was its position. Evidently, it has to be in a section, whereas I was just assuming it could be with the other !insertmacro statements.
So now it's in the "MainSection", and working fine.