sorted merge for linked list