Here is some code to help you with it.
sync on : sync rate 60
hide mouse
backdrop off : ink rgb(255,255,0),0
if file exist("hello.txt") = 0
open to write 1,"hello.txt"
write string 1,"hello world"
close file 1
repeat
text 100,200,"hello.txt file written."
sync
until spacekey() = 1
else
open to read 1,"hello.txt"
read string 1,a$
close file 1
repeat
text 100,100,a$
text 100,200,"How's that?"
sync
until spacekey() = 1
endif
show mouse
end
I would suggest saving the source file first and then reload the source so that you will know where it will write the files. You can indicate in your code where you want the file to be written, but the example simply writes a file in the current directory.
Run the code. Find the 'hello.txt' file and open it. Make the edits to it and save it and then re-run this program.
I hope this helps.