Basically, to embed text in your document (tex input file) which is written to an external document when you process it, you can use buffers:
<texcode>
\startbuffer[x]
x
\stopbuffer
\savebuffer[x][temp.log]
</texcode>
The second argument is optional and when omitted the buffer will be saved as <code>jobname-<buffername>.tmp</code>.
----
Written in 2010
LaTeX provides a <code>filecontent</code> environment to embed text in your document
which is written to an external document when you process it. The filename is given with
\stopfilecontents
</texcode>
Instead you can use buffers:
<texcode>
\startbuffer[x]
x
\stopbuffer
\savebuffer[x][temp.log]
</texcode>
The second argument is optional and when omitted the buffer will be saved as <code>jobname-<buffername>.tmp</code>.