Elements at joined after running dynamo script

I made a script to number all beams in plan. i sorted beams on basis on start point coordinates.

After running the script, i found that all my elements (beams) as joined to each other as i tried to move one beam to other location.

why so?

It’s impossible to see the error message unless any physical condition of an element is changed.
I suppose your script changed something rather than just parameters or selection.