Bear in mind this will only work in IE with the correct "relaxed" security permissions.
All the information can be found under FileSystemObject Basics.
When you CreateTextFile (or OpenAsTextStream in write mode) you get a TextStream object back which has a WriteLine method, among others. Please see the examples for "the code".
Happy coding.