I don't think it is because of a permission issue, since I can get math kernel command prompt by simply typing math, and then I can normally do calculations. I also tried Print instead of Put but nothing happened! I don't know if it helps, but when I type math -initfile test.m, I only get math kernel command prompt, ready to accept inputs, with no reaction to my .m file, like this
In[1]: