Linked List Cycle Detection

I have implemented linkedt list cycle detecton and then created a linked list with a cycle such that if you give input as 7 6 5 4 3 2 1 -1 then 4->next will point to 2.and my function is showing that there is a cycle in Linked List but on printing the linked list it is still showing linked list as 1 2 3 4 5 6 7 but my doubt is if i have pointed 4 towards 2 then how is it printing 5 after 4?
Link to code-> https://ide.codingblocks.com/s/597376