NEED HELP FINISHING PROGRAM (POSTED)

I need this to print the numbers out in ascending order instead of random
order.  I am having trouble figuring it out.  If you can help me it will
be appreciated.

Program ch14 (input, output);
{Produces a list of 1000 numbers without duplicates and lists them in
order}

uses crt, printer;
label 10;
var
  pnum, a, b, x, y, z: integer;
  num: array [1..1000] of integer;
  order: array [1..2000] of integer;
  outfile: file of integer;

procedure sort;
begin
  for x := 1 to 999 do
    for y:=x+ 1 to 1000 do
      if num [x] >num[y] then;
      begin
         z := num[x];
         num[x] := num[y];
         num[y] := z;
      end;
  end;

begin
   clrscr;
   assign (outfile, 'a:c14.txt');
   rewrite (outfile);
   randomize;
   for a:=1 to 2000 do
   order [a] := 0;
   for x:= 1 to 1000 do
      begin
        10:pnum:=random(2000) + 1;
        if order [pnum] = 0 then
           num [x] := pnum else
           goto 10;
        order[pnum] := 1;
      end;
   sort;
   for b:= 1 to 1000 do
       write (outfile, num [z]);
   for b:= 1 to 1000 do
      if b mod 10=0 then
      writeln (lst, num[b]:8)else
      writeln(lst, num[b]:8);
   end.