OpenWrite
OpenWrite["file"] opens a file for writing and returns an OutputStream object.
OpenWrite[] opens a new temporary file.
Examples
Open a file for writing:
stream = OpenWrite["output.txt"]
(* OutputStream[...] *)Write and close:
stream = OpenWrite["output.txt"];
WriteString[stream, "Hello, World!"];
Close[stream];Please visit the official Wolfram Language Reference for more details.