Sort Curves along Y axis

Hello everyone!

I need a bit of help in a grasshopper file. What i´m trying to do, is to organize several polylines creating a grid. These polylines are on a side and I want them forming a grid where the first element is the lowest one in the Y axis, and so on. Secondly i want the initial polylines and the ones on the grid join by a line.

I´ve managed to create the grid and sort the points. Also sort the points of the center of the polygons so the lowest one is 0 on the list and join this pair of sorted lists by lines.
However when trying to move the polyline to the points of the grid they go to there original list value. As you can see in the picture in the selected list item component, the number 0 is number 6 counting from the bottom, and it should be number 6 so when moving them to the grid it moves to the desire place.

Are you able to upload your script and model, that makes it easier to find the problem as well as add a solution.