updated print_list function and added code for removing node