Doubt in " Linked List-K Append"

My code get runtime error .please tell me what is wrong .

Rahul, can you plz tell the approach you have used in your print function, as your print function is not correct due to which it is showing runtime error, I have made some changes, refer to this code, here I have used normal print function to see if your list is getting made or not,

I apply the approach which is tell in the hint video.
Please can you tell me why runtime error come when i
write int l and int k in print function and when i do not use them i does not get any error.
Basically in every problem of linked list i got runtime error.If runtime error was not come the program does not print any value.

Rahul, it is always advisable to use print function as a separate function as I have used in the edited code, it is simply used to print the linked list, make a separate function for the approach you are using for a specific program.