MRNM stands for "Mate reference index". So Picard found something in the RNEXT field which should be set only for paired-end reads but the rest of the file looks like single-end.
The problematic line in your code is:
line.next_reference_id = 0
This sets the RNEXT SAM field to whatever Pysam stores as a reference with index 0 (next_reference_id). ...