More linked list Question!(please help);

HI,
 I just wan to thank all the people  who helped me so far, but seemes like
that i need more help. As I posted previously i 'm writing a program that
will read a file containing  for example:
A 12   (* 'A' means insert that number into the linked list )
A 56
A 78
D 56 (* 'D' means delete that number from  the list *)

I also have a unit that i have to use, well let me just tell you that my
insert procedure that my teacther gave me don' t actually insert anything in
the list , it just link up to a temporary pointer who has the data. same as
my delete.
here  what i got so far :

     While not eof(infile)  do
       Begin
         readln(infile,inchar,inval); (* reads the 'a' or 'd' and then the
integer *)
         if inchar = 'A' then
           begin
             new(p);  (* create a pointer *)
             p^.data := inval; (* give that pointer the value in the file *)
             insert(l,p,Prev); (*connect that pointer to the list *)
             l := next(P);       (*i don't think this  is right *)
           end
         else if inchar = 'D' then
             begin
               if P^.data = inval
                                         (* if P^.data = to some number in
the list  delete *)                                          (* that number
*)
                  begin
                   delete(l,p,prev);
                   dispose(p);
                 end;
              end;
i also have to sort the list in ascending order . for example if the file
had the  example value i mentioned earlier the output screen would be :

the list contain :
->12 -> 78   (* because D 56 would have delete that number from the list *)
Can anyone show me how they would do this or even send me a sample code
Please  this is my first computer science class and it's going so fast
sometime i can't keep up .

Thanks for your time,
Armel A.

my e- mail is Ar...@dreamscape.com