optimizing the word list generation by using list append method