Linked List-K Append RunTime Error

So in this code 1 test case runs successfully but others give error , please suggest why .
code link - https://ide.codingblocks.com/s/101479

if(n>=this.size)
n = n%this.size;
if(n == 0)
return;

You will have to add these conditions to the beginning of your code. Because according to the question, k can be greater than N, so your index will be negative in such a case and you will get a runtime error