Time limit exceeded eroor apperaring

i am getting time limit error
#define ll long long
#include<bits/stdc++.h>
using namespace std;
class node{
public:
int data;
node* next;
node(int d){
data=d;
next=NULL;
}
};
node* list1=NULL;
node* list2=NULL;
void insert(node*&head,int data){
if(head==NULL){
head=new node(data);
return;
}
node* tail=head;
while(tail->next!=NULL){
tail=tail->next;
}
tail->next=new node(data);
}
void print(nodehead){
while(head!=NULL){
cout<data<<" ";
head=head->next;
}
}
node
merge(nodea,nodeb){
if(a==NULL){
return b;
}
else if(b==NULL){
return a;
}
node*c;
if(a->data < b->data){
c=a;
c->next=merge(a->next,b);
}
else{
c=b;
c->next=merge(a,b->next);
}
return c;
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long t;
cin>>t;
while(t–){
long a,n,k;
cin>>n;
while(n–){
cin>>a;
insert(list1,a);
}
cin>>k;
while(k–){
cin>>a;
insert(list2,a);
}
list1=merge(list1,list2);
print(list1);
cout<<endl;
}
return 0;
}

list1=merge(list1,list2);
print(list1);

these two lines should come inside while loop

but they are inside while loop only. while(t–)

please send the link of code
so that i can check and run the code