Implement append function for linked list