Working with text file is rather simple in Pascal. See the below example for first writing data to a text file, then reading it back from it.
program FileTest;
var
outputFile: text;
inputFile: text;
line: String;
begin
Assign(outputFile, 'test.txt');
Rewrite(outputFile);
WriteLn(outputFile, 'First line');
WriteLn(outputFile, 'Second line');
Close(outputFile);
WriteLn('WRITING - All Done');
Assign(inputFile, 'test.txt');
Reset(inputFile);
while not eof(inputFile) do
begin
ReadLn(inputFile, line);
WriteLn('Line read: ', line);
end;
Close(inputFile);
WriteLn('READING - All Done');
end.
For more details and how to use binary files, read here.