1 test case not passing

try to debug for this input:
4
1 2 3 4
4
correct output :
1 2 3 4

I put a if statement in k_append
if(n==k)
{
return;
}
Still getting TLE how to fix that?

do n = n % length for cases where n > length