Insert into text file some text from a script

Hello,

How can I insert into a text file some information for example I would like to insert into different lines the numbers 1 to 10 into a text file and save it into the files.

/file print file=Number
/file set Number.txt contents=" " 
:for i from=1 to=10 do={ :put $i }

but instead of showing that on the terminal everytime I run it…I would like it to be saved on the contents of Number file in different lines…

{
 :local tmp "";
 /file print file=Number

 :for i from=1 to=10 do={ :set tmp "$tmp\r\n$i" }
 /file set Number.txt contents=$tmp 
}

Tks mrz…it works just like i wanted..