Please help and tell me my mistake

try this approach :

Node intersectionOfTwoLinkedLists(Node l1, Node l2) {
    if (l1 == null || l2 == null)
        return null;

    Node a = l1;
    Node b = l2;

    while (a != b) {
        a = a == null ? l1 : a.next;
        b = b == null ? l2 : b.next;
    }

    return a;
}