made the head a function parameter, and fixed wrong while loop for displaying the list
passed the head in the function and corrected wrong while loop in displaying the linked list
passed head in function parameters, corrected wrong while loop in displaying the linked list
passed head in function parameter, corrected wrong while loop in displaying the linked list