Could someone please help me identify the problem with the code below.

```
#include <iostream>

using namespace std;

struct node
{
    int a,b;
    struct node* next=NULL;
};

node* head=NULL;

void insert(int a,int b)
{
    if(head==NULL)
    {
        head=new node;
        head->a=a;
        head->b=b;
        return;
    }
    node* cur=head;
    while(cur!=NULL)
    {
        cur=cur->next;
    }
    cur=new node;
    cur->a=a;
    cur->b=b;
    return;
}

void display()
{
    node* cur=head;
    while(cur!=NULL)
    {
        cout<<cur->a<<"\t"<<cur->b<<"\n";
        cur=cur->next;
    }

}

int main()
{
    int i;
    for(i=0;i<3;++i)
    {
        insert(i,i+1);
    }
    display();
    //cout<<h->next->a;
    return 0;
}

```

This is the output that I get:

```
        0        1

```

It seems that I can only display the head node and none after gets inserted. If I try to access the next node after head, I get a segmentation fault. Why is that?