You need both of those lines for the code to work correctly as far as I can tell. b.next = head.next
makes b point at whatever head was pointing at (aka the first node in the list). And then head.next = b
makes head point at b. Therefore these two lines insert b at the front of the linked list.
Here is a link with some more information on linked lists
2
solved C#, Linked List, what is the difference between the last two lines?