Run time error in inttersection point of linked lis

my code is showing run time error while running what is the problem.
my code------

#include
using namespace std;
class node
{
public:
int data;
node* next;
//constructor
node(int d){
data=d;
next=NULL;
}
};
void insertAtTail(node*&head,int data){
if(head==NULL){
head=new node(data);
return;
}
node* temp=head;
while(temp->next!=NULL){
temp=temp->next;
}
temp->next=new node(data);
return;
}
void buildlist(node*& head,int n){
int data;
cin>>data;
while(n–)
{
insertAtTail(head,data);
cin>>data;
}
}
int intersect_point(node* a,node* b){
if(a == NULL || b == NULL){
return -1;
}
if(a->data>b->data){
return intersect_point(a,b->next);
}
else{
return intersect_point(a->next,b);
}
}

int main() {
int n1;
cin>>n1;
node* a=NULL;
buildlist(a,n1);
node* b;
int n2;
cin>>n2;
buildlist(b,n2);
cout<<intersect_point(a,b)<<endl;
return 0;
}

The approach you are trying to use for finding the intersection point in your code is wrong… Try to use some other logic in your code… For hints, you can think of a method in which you will first determine the difference of lengths of two linked list, and then start traversal of both linked list together uptil a point when the data values of both doesn’t match , forming a y-shape structure…

now my code worked in 3 test cases but failed in 1 test case can you correct it,
this is the code after correction https://ide.codingblocks.com/s/166402