Hello! I need some help to create a program with PASCAL.

My task is to read a text from file and create and write the text in new text file (txt). But - if text read from the file consist the word "end" then do not write the rest of the text after "end" in new text file (txt).

For example:
The file read from is:


But file created and write into is:


Could you please help about the text in bold please, how it is done?