Two testcases are not solved. What condition am I missing here?

This is linked list-k append assignment question :

You have not included the case when k>N, thus in that case you cannot directly append, add the below lines and then try to submit your code
k=k%N;
if(k==0)
{
print(head);
}
else
{
head=append_nodes(head,k);
print(head);
}