Create a file, from a template, using global variables

Hi,

I want to create a file, which will serve as input file for some component.

For this, I have a template file, like this:

------------------------
Simulation time: 1000 ns
Molecule: XXXX
Method: Monte Carlo
Output: YYYY
Error: ZZZZ
etc...
------------------------

I assign the global variables XXX, YYYY and ZZZZ, but this is not clear to me how to pass them to this file so at the end I get a new file with the assigned values like:

------------------------
Simulation time: 1000 ns
Molecule: methane.inp
Method: Monte Carlo
Output: traj.dat
Error: error.txt
etc...
------------------------

For this purpose I looked to all the different components, but I do not find anything useful for my purposes.

Could you please tell me how would you proceed with this problem ?

Thanks

WS