I created a stream where the message goes through a loop and inside the loop I make a node.send on each iteration for the next node to store the information in the file, however the information is repeated several times in the file, as can be seen in debug. I made an example model to illustrate my problem, as follows:
[{"id":"4102703d.b8d97","type":"function","z":"f800399f.f91e98","name":"","func":"let test = [0,1,2,3,4,5,6,7,8,9,10]\n\nfor(let i in test){\n msg.payload = test[i]\n node.send(msg)\n}\n\nreturn\n","outputs":1,"noerr":0,"x":1570,"y":360,"wires":[["a3ff2780.a7cb88"]]},{"id":"3a6a3bac.bcd8e4","type":"inject","z":"f800399f.f91e98","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"300","x":1340,"y":360,"wires":[["4102703d.b8d97"]]},{"id":"a3ff2780.a7cb88","type":"iconvfile-out","z":"f800399f.f91e98","name":"","filename":"test","appendNewline":true,"createDir":false,"overwriteFile":"false","charset":"UTF-8","x":1790,"y":320,"wires":[["24447700.93a97a"]]},{"id":"24447700.93a97a","type":"debug","z":"f800399f.f91e98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1950,"y":320,"wires":[]}]