Creating and sorting a linked list in C