Actually, I made another small adjustment to only get the distinct values. Thanks again.
distinct_value = []
with open ("MDMALL.txt",) as myfile:
with open ("MDMADJUST.txt",'w') as newfile:
for lines in myfile:
if lines.startswith("TXA") and lines.split("|")[5] not in distinct_value:
distinct_value.append(lines.split("|")[5])
newfile.writelines(lines.split("|")[5])
newfile.writelines('\n')
print(*distinct_value, sep = '\n', end = '')