For this task, you'll want to create a dictionary of line numbers as the dictionary's key and point XYs as their value. Then create your new line feature class with the same spatial reference as your point feature class. Iterate through your dictionary, sort your XYs, and then create a polyline geometry object from your sorted points.
This method assumes that all points that should be connected in a single line hashave a shared ID value.
Given:
Try this script:
import os
import arcpy
#point feature class
pntFc = r"C:\Path\To\PntFc"
#id field
idFld = "Line"
#line feature class
lineFc = r"Path\To\Output\LineFc"
#create point dictionary
di = {}
with arcpy.da.SearchCursor (pntFc, [idFld, "SHAPE@XY"]) as curs:
for line, xy in curs:
try: di [line] += [xy]
except KeyError: di [line] = [xy]
#create new line feature class
sr = arcpy.Describe (pntFc).spatialReference
linePath, lineName = os.path.split (lineFc)
arcpy.CreateFeatureclass_management (linePath, lineName, "POLYLINE", spatial_reference = sr)
#add line ID field to line feature class
fldType = [f.type for f in arcpy.ListFields (pntFc) if f.name == idFld][0]
arcpy.AddField_management (lineFc, idFld, fldType)
#insert cursor
with arcpy.da.InsertCursor (lineFc, [idFld, "SHAPE@"]) as iCurs:
#iterate dictionary
for lineId in di:
#get point xys
points = di [lineId]
#create array
array = arcpy.Array ()
for x, y in sorted (points):
array.add (arcpy.Point (x, y))
#create geometry
geom = arcpy.Geometry ("polyline", array, sr)
#insert row
row = (lineId, geom)
iCurs.insertRow (row)
Result: