Long text export

Good evening,
i need to export in a .txt file a long text modified by some funcion.
The example of text is

0
0
0

{{{some var}}}

0
0
0

I've try something like

var a = 0
0
0
0

but this is not correct.

Any ideas?
Thank you!

I don't fully understand your usecase.
But maybe multiline string formatting does the trick?

msg.payload = `
0
0
${msg.payload}
0
0`;

return msg;

Thank you walbaer, it words perfectly!

Good evening waldbaer,
i need to ask you something more.
I have file, that i read from "read file" function.
Can i change some line of this text like you did in your example?
I've tried to change the original file with ${variable} in specified point but the result is ${variable} also in the output.

Thank you!

@danieleronchi please provide some more context and concrete function code you are using.

Modifying 'any' line of a parsed file depends on the file content.
Either the content is a parsable format you can parse, modify structured data, export.
Or you know exactly the location you want to modify (e.g. the line number, character number etc).

But a general answer is not possible here if I must assume that you just have a text file with random content. A file ist in principle just a long chain of bytes. Even characters can be encoded with many different encodings etc.