Linked list K append

What is the problem with the solve function as the test cases are not getting passed. Below is the code:

if(m != 0 )
head=appendK(head,m);

just add if(m != 0 )on line 72