The main logic problem I see is that the code that increments Cntnopol and sets on indicator 80 is at a different nesting level of your IF logic than the code that writes to the printer file. If your chain to LMADDR fails, you will still perform the WRITE DETL01 but you will not increment Cntnopol. For both stylistic and logical reason, you should always keep related code such as incrementing a line counter and printing adjacent to each other.
I’m not sure if this will fix the specific problem you are currently having, but it will be an issue at some point. You might want to try putting your program in debug mode and stepping through it line by line to get a better understanding of when your header and detail lines are printing.
You may also want to remove the OFLIND(*In80) from the F spec of your printer file. Since you are manually controlling the line counting the automated overflow may be causing the header to print twice at the beggining.
If you are still having problems post the print file source here for us to look at.