Write to a .txt file

example of the message?

you have already obtained something:
http://forum.mikrotik.com/t/help-with-this-script/157065/1