Using recursion to insert node at the tail of a list