As Windowskiller says, the number after Write String is the file (or channel) number.
Think of them as 'pipes' which connect your program to a disk file.
You can open a number of files on disk for reading or writing - each with a unique channel number. In the Read and Write commands, this number tells DB which file (pipe) to send the information down so it ends up in the correct file.
If you only have one file open, it's generally number 1 so all the commands refer to the number 1:
myValue = 123
myValue2 = 456
if file exist("myfile.txt") then delete file "myfile.txt"
open to write 1, "myfile.txt"
write string 1, str$(myValue)
write string 1, str$(myValue2)
close file 1
Str$ is a DB function which takes a numeric value and turns it into a string. VAL() is the DB function which takes a number in string format and turns it back to a numeric value.
TDK_Man