I saw the below threads and they are very useful and related to my problem
Writing in file | Swi-Prolog | Windows\
Prolog insert, modify and delete facts on a separated database text file
I tried to use tell, told see , seen to read write from text files but I have the same result nothing is written on the file when (I open it and see that) , and on the read either the system read end_of_file or have an error displayed in a message or on the console Below is some samples of my work :
start1:-
open('output.txt',write,OS),
X = 'Hi all',
write(OS,X),
close(OS),
open('output.txt',read,OS2),
read(OS2,Input).
start1:-
absolute_file_name('X.data',Abs),
open(Abs,write,Out),
tell(Abs),
write('HiAll'),
told,
close(Out),
open(Abs,read,In),
see('X.data'),
read(X),
seen,
write(X).