
I've been trying to make the script myself, but it's just too hard for me

I've also searched on the forum, but nothing seems to work
So first, I want to write a line in a text file:
proc savevar
set thevar $text
save $thevar in $thisfile (so there should be just 1 line in the text file, this means replacing an other line

Second:
I want to make my bot read the file and save the line into a var on every load.
How can this be done? :/
Thank you very much