Merge overlapping lines together in the output