Take a look here:
http://forum.thegamecreators.com/?m=forum_view&t=47667&b=10
The second method is much simpler, but the first method can be used and I actually perfer it

.
Here's a break down of the first method:
First you need to check if the file you want to create already exists or not. If it does already exist then you need to delete it because the "Open To Write" command creates only a new file.
The code will look like this:
If File Exist("File_Name.txt")=1 Then Delete File "File_Name.txt"
Then you need to actually create the file.
Like This:
Open To Write 1,"File_Name.txt"
Then you need to store your data in the new file. There are a few different ways you can do this by using either the "Write Byte" command or the "Write String" command. I usually use the "Write Byte" command because then the user can't open the file and change the data and stuff, well they could, but the won't no what it means

.
So Either Like This:
Write String 1,Player_Health
Or Like This:
Write Byte 1,Player_Health
Then after you have stored all the data you want to the file, you have to close the file.
Like This:
That's it for storing all or data, now all you got to do is retrieve all the data from the file

.
So, the first step would be opening the file by using the "Open To Read" command. However, make sure the file exists or the command will fail and cause an error.
So Like This:
Open To Read 1,"File_Name.txt"
Then you have to read in all the data from the file to your program.
Either Like This:
Read Byte 1,Player_Health
Or Like This:
Read String 1,Str$(Player_Health)
However, if you saved the data to the file as a byte then you must use the "Read Byte" command and its the same case with a string.
Then you must close the file.
Like This:
And that's all there is to it, although it may look like a lot of work its not really when you get used to it, eventually you'll be able to do it in like 20 seconds.
The final code would look like this:
Player_Health=100
If File Exist("Data.txt")=1 Then Delete File "Data.txt"
Open To Write 1,"Data.txt"
Write Byte 1,Player_Health
Close File 1
rem Just Changing The Varible To 0 Just So you can see that the
rem varible is actually getting loaded in
Player_Health=0
Open To Read 1,"Data.txt"
Read Byte 1,Player_Health
Close File 1
Print Player_Health
End