update method of class linklist