Insert node in linked list at head hackerrank solution in java