|It looks to me like you are interested in someone doing your homework.|
I'll get you started. First, this link shows you how to read a file line by line:
Next, the solution to your problem is lines starting with DL is your base line. It changes every time a new DL line appears. With any other line, to the base line, append a pipe symbol and that line onto the base line and print it out.
The hard part is determining if the line starts with DL. This if statement does that:
if echo $line| grep "^DH" > /dev/null