Code shows error in some test cases

The code that I have written is working fine for some test cases and is showing error for others.
I can’t find what’s wrong in it . Please help.
Here’s the code : https://ide.codingblocks.com/s/238370

@raghav0712 for k=n u have to print linklist as it is and for k greater than n k = k%n

yeah , missed that part

thanks a lot for the help