Problem writing to a file

I have my XML file in this format
<productvals tinterval=“20” >
<set name=“San” value=“65” />
</productvals>

I want to overwrite this file each time in flash
I tried but got problem in double quotes and new line
How can I overcome them?
var fileContents = “<productvals tinterval=”;
fileContents=fileContents+tinterval;

I just want to know if it would be possible to write the whole file in one go and what should be the content of fileContents variable which I am writing to the file using php
loadVarsText.load("<A href=“http://localhost/writeFile.php?&stuffToWrite="+fileContents">http://localhost/writeFile.php?&stuffToWrite=”+fileContents);
Thanks!