This function will remove overlapping lines and replace (not merge) each segment with one of the features:
def remove_overlapping(input_polyline, output_polyline, tolerance=0):
"""Identifies overlapping (portions of) of a polyline feature class and replaces with one feature."""
overlapping_segments = ScratchPath + "\\Scratch.gdb\\overlapping_segments"
# Tolerance defines "overlap."
tolerance_expression = str(tolerance) + " Feet"
# Cutout overlap portions.
arcpy.Intersect_analysis(in_features=input_polyline, out_feature_class=overlapping_segments, join_attributes="ALL",cluster_tolerance=tolerance_expression,output_type="LINE")
# Discard all but one feature.
multipart_after_erase = ScratchPath + "\\Scratch.gdb\\multipart_after_erase"
arcpy.Erase_analysis(input_polyline, overlapping_segments,multipart_after_erase, cluster_tolerance=tolerance_expression)
# Break apart multipart features which might have been created when using erase.
# Put the remaining feature (after DeleteIdentical) back into the rest of the feature class.
arcpy.Append_management(inputs=overlapping_segments, target=output_polyline, schema_type="NO_TEST", field_mapping="#")