How to shuffle the list based on model line

revit

#1

I am trying to rename the mark value based on model line. But the my result came on X and Y coordinates, I want to rename the element based on model line. Here is my script.


#2

Sorry guys my results are came based on the element id. I wrongly mentioned as X and Y coordinates. Thanks in advance.

.