Reassigning a local variable at the end of a method isn't going to change anything. You need something like:
Element e = this.data[index];
while (e.getNext() != null) {
e = e.getNext();
}
Then e
refers to the element at the end of the list. Create a new element, and set that as the next one:
Element newElement = new Element(s);
e.setNext(newElement);
For efficiency, I'd urge you to consider doubly-linked nodes and a list type which knows about the head and tail of the list. Differentiate between the list as a whole (which knows the head, the tail, and probably the count), and a node within the list (which knows about the next, previous, and possibly what list it belongs to).