doing convert array into linked list function