Let me point out that there are at least 3 ways to sort a linked list. Suppose that your inspection of the variables used in the sort criteria indicate that you should swap elements 2 and 7.

You can exchange all the data for elements 2 and 7, except for the links.

You can exchange the links for elements 2 and 7.

You can establish an array of pointers to the elements and merely swap the pointers in the array.