Line 13: You initial 'cur' with some value.
Line 14: You immediately overwrite this value with the value of 'head'.
Line 15: You assign 'cur' to 'head', but 'cur' currently contains the value of 'head', so you are essentially assigning the value of 'head' to itself.
In other words, all you're left with is a memory leak, and nothing else is changed.
PS: The return statements at the end of a void function are not necessary.
You are correct, line 14 is making cur point to the same data that head is pointing to. But you don't want this. You want cur to point to the dynamic memory you just allocated on line 13. Otherwise, what was the point in calling 'new SinglyListnode(val)'?
Pointers can be confusing, so let us know if it's still not clear; maybe somebody can explain it in a different way.
But to restate it a slightly different way:
1 2 3
SinglyListNode *cur = new SinglyListNode(val);
cur = head;
head = cur;
When getting to grips with linked lists, I find it useful to physically draw the nodes on paper as squares with lines going between the squares representing the links. Then walk through the code as the computer would and add the squares and lines etc as per the code and mark what variable points to where.