While we inserted a node at the end using tail->next=new node(data), why didn’t we make the last node point towards null ?
Inserting at the end
It is because all the new nodes point to NULL by default. When we call the Node() constructor and pass data to it, we set data to the integer part of the Node and we set the Next part of the Node to NULL. So, there is no need to do it again.