program Files;
{$mode objfpc}{$H+}
var
  F: TextFile;
  Line: string;
  N: Integer;
begin
  AssignFile(F, 'shopping.txt');
  Rewrite(F);
  WriteLn(F, 'two disks');
  WriteLn(F, 'a network cable');
  CloseFile(F);

  Append(F);
  WriteLn(F, 'a UPS');
  CloseFile(F);

  Reset(F);
  N := 0;
  while not Eof(F) do
  begin
    ReadLn(F, Line);
    Inc(N);
    WriteLn(N, '. ', Line);
  end;
  CloseFile(F);
end.
