The following code does not produce a file (I can't see the file anywhere). What is missing?
I think your expectations and reality don't match (but when do they ever ;))
where you think the file is been written and where the file is actually been
written are not equal (hmmm, perhaps I should write and
Also note that your example will override any existing files. If you want to append the text to the file you should...