this is the kind of code i use for writing to a text file
filename=Server.mappath("\pathtofile\log") & ".txt"
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set file = fs.opentextfile(filename,8,true)
file.writeline
file.write "TEST"
file.Close
set file=nothing
set fs=nothing