I do not believe the for loop is necessary. I think that is what is causing the issue you described. A for loop could be used to check for duplicate values.
I think you can sort your list alphabetically in the following way
def get_unique_words(text):
# converts all alphabetical characters to lower
lower_text = text.lower()
# splits string on space character
split_text = lower_text.split(' ')
# sorts values in list
split_text.sort()
# empty list to populate unique words
results_list = []
# iterate over the list
for word in split_text:
# check to see if value is already in results lists
if word not in results_list:
# append the word if it is unique
results_list.append(word)
print(results_list)
text = "The quick brown fox jumps over the lazy dog!"
get_unique_words(text)
This returns the following list
['brown', 'dog!', 'fox', 'jumps', 'lazy', 'over', 'quick', 'the']
Taking the next step you probably want to remove duplicates and also drop any non-alphabetical characters.
For the non-alphabetical characters, it would be best to use regex which can be imported
import re
Here is a good post on how to remove non-alphabetical characters
Python, remove all non-alphabet chars from string
And for removing duplicates it may be best to convert the list into a dictionary. Here is a post on how to do just that
https://www.w3schools.com/python/trypython.asp?filename=demo_howto_remove_duplicates