AppendToList, PrependToList methods for both stack and list