Insertion in link list

i am trying to insert a node at the end of the link list as

the code running but i don’t understand that when in line no 16 when i am passing head by reference then it is printing the link list in reverse order and when i am passing it by value then it is not printing anything please explain