Just update node and your problem will be solved
Here is what the above code is Doing:
1. It’s creating a new instance of the class Node.
2. It’s setting the value of the node to the value passed in.
3. It’s setting the next property of the node to the next value passed in.
4. It’s returning the node.