Only 2 text cases pass and remaining shows TLE ? whats wrong in my piece of code?

#include
using namespace std;

class node{
public:

int data;
node * next;
node(int d){
	data = d;
	next = NULL;
}

};

void CreateLinkList(node *& head , int num){

if(head == NULL){
node * n = new node(num);
head = n;
}
else{
node * temp = head;
while(temp->next != NULL){
	temp = temp->next;
}
temp->next = new node(num);
}

}
void jump_position(node *& fast , int position){

while(position--){
	fast = fast->next;
}

}
node * find_element_last(node * head , int position){

node * fast = head;
node * slow = head;

jump_position(fast , position);
while(fast->next != NULL){
	fast = fast->next;
	slow = slow->next;
}
return slow;		

}
node * last_element(node * head){

	node * tail = head;
while(tail->next!=NULL){
	tail = tail->next;
}
return tail;

}
void print(node * head){

while(head != NULL){
	cout<<head->data<<" ";
	head = head->next;
}

}
int main(){

node * head = NULL;
int n;
cin>>n;
while(n--){
	int a;
	cin>>a;
	CreateLinkList(head , a);
}

int k;
cin>>k;

node * prevK =  find_element_last(head , k);
node * kth = prevK->next;
node *  tail = last_element(head);

prevK->next = NULL;
tail->next = head;
head = kth;


print(head);


return 0;

}

hey, it is quite tough reading this unindented code
i am giving the actual solution for the problem, the one that i coded

common mistakes
check for the case when k==n, return the list as it is
for cases k>n, so u have to take k = k%n