Getting the wrong output with the same code

I merged 2 sorted linked lists but when I cout the head and head 1 I am getting the wrong output
Here’s my code:

you have not passed the head by reference
but here they are passed by reference already because you have passed the address
so any changes made on address will also reflect on main

i hope you understand that
if not then feel free to ask

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.