The obvious change is that Delphi 7 uses ANSI text, and XE uses UTF-16 text. I guess you'll need to convert the text to ANSI explicitly in order to match previous behaviour.
var
ansistr: AnsiString;
....
ansistr := AnsiString(slPrintLines.Text);
Then you can send that to the file handle in the same way as you did previously.
There are many other issues in this code but I don't want to perform a complete re-write. This is the main issue that you face.
Before you do anything else you must read Marco Cantù's white paper on Delphi and Unicode. There's no point continuing until you have a good understanding of this major breaking change introduced in Delphi 2009.