Linked List-K Append Doubt

My Code Passes only 2 test cases kindly help me in my mistake.
Link to my code