Like BN2 says, the file has to be deleted. Open to write creates a file, then loads data to it. If there is a file already with the name you're trying to use, then it will return an error. Therefore this code may cause problems
open to write 1,"filedata.txt"
where this code would work fine
if file exist("filedata.txt")
delete file "filedata.txt"
endif
open to write 1,"filedata.txt"
However it is worth remembering that deleting files haphazardly may cause problems. Therefore, if the file is required for your game (for example a high score table) it may be worthwhile loading all the data into your program using
open to read, then storing it, before you delete the original file. That way, important data won't be lost.
"A West Texas girl, just like me"
-Bush