My code not working fine

code-https://ide.codingblocks.com/s/238657
line 212 kth code function is written

for which case it is not working

Output

1->2->4->5->6->7->
5
printing 3 rd node from last
correct