Please check out _examples/TechnicalExamples/_WritingAndReadingASCII.xml (text data format)
or _examples/TechnicalExamples/_WritingAndReading.xml (bonary data format)
The above examples will show you how to write data into a file.