It'd be better if you provided your code.
Anyway, the two ideas that come to my mind now are :
- Right problem ? Are you sure you have to right to write your xml file to the filesystem on the remote Web server
- Path problem ? Are you sure the path you use in your script (for example to know where to write) is correct ? I'd advise you to use absolute path if you run the script through cron or script, as you do not master the environnment variables and more particularly PATH.
HTH