Your first file has an extra space on each echo line after the for loop. Remove that and your program will compile.
However, that is not how you write a macro. You need to generate NimNodes instead of just printing to the screen. I can give an example when I get to my computer.