Every :put automatically adds a newline.
Instead, you could build a string in a variable by adding the new item to the string in the loop.
However, note that the maximum length of a string in RouterOS is 4096.
This is an instance. I need the way to put incapsulated (to prevent 4096 bytes limit) in local:script2write data in a single line. Tried both, colon doesn’t affect anything in this case (I’m new to routerOS scripting)
RouterOS is quite limited in handling large amounts of data. You would need to change some other part of your system so the newlines do not matter.
You also see these problems when reading data from a file. There is no “open/loop read until EOF/close” construct in RouterOS scripting, you can only read all data in one go and then you encounter the 4096 byte limit again.
Notice that scripting is mostly for handling some simple events and adding some flexibility, it is not intended and not capable of writing complex applications that process data.
There used to be a better programming language (lua) for that, but it was removed at some version way in the past.