Not Desired Output

Respond faster please & let me know what’s wrong with the code

This is the code for Insertion in Linked List.

Current Output:-
3–>

Desired output :-
1–>2–>3–>

image
update ur head after line 21.
i.e
head=n;

Oh, Okay! Thanks for the help!