In a Binary Search Tree you have to place any new elements in as leafs. Your code starts off by checking if we are currently looking at a node and if so, then insert our data here. Otherwise we need to continue down a branch until we reach a leaf. Therefore we call this function on the left or right branch (depending on the number and the data in the node). The way we do it is by calling the function on either node.left or node.right. If the child is a null, then we want to say that now our child is this new node that we just inserted.
If the child is not a leaf, then by returning the original child this assignment will do nothing. It only does something by saying
node = new BNode(data);
and therefore the previous time this was called will be the only one that gets its left or right child changed to the current new leaf and all other left and right children remain the way they were.