Intersecting elements in array : Can anyone please tell why I am not getting correct solution.. started programming few days ago...

There are 3 arrays and code works if there are less elements.. idk whats problem..please give me solution thanks..

here is my code:-

    int arr1[]={1,2,3,5,7,8,9,11,12,18};
    int arr2[]={2,3,4,12};
    int arr3[]={2,3,5,12,19};
    int arr4[10];
    int k=0;
    int x=0,y=0,z=0;

    while(arr3[z]!=19)
    {
    if(arr1[x]==arr2[y] && arr2[y]==arr3[z])
    {
        arr4[k]=arr1[x];
        cout<<" intersecting element found "<<arr4[k];
        k++;
        x++;y++;z++;
    }
    else if(arr1[x]<arr2[y])
    {
        x++;
    }
    else if(arr2[y]<arr2[z])
    {
        y++;
    }
    else
    {
        z++;
    }

    }
    for(int i=0;i<k;i++)
    {
        cout<<endl<<" o/p "<<arr4[i];
    }
