Why do you want to do this using several threads? Perhaps your example has been oversimplified, but if you can avoid threading then do so - and it would appear that this problem doesn't need it.
Do you have lots of files, or one really large file, or something else? Why can't you simply perform the three actions one after another?
UPDATE
I felt I should at least try and help you solve the underlying problem you're facing. I think you need to consider the task you're looking at as a pipeline. You start with strings, you remove special characters (clean up), you write them to file. When you've finally written all the strings you need to sort them.
Everything up to the sorting stage can, and should, be done by a single thread. Read string, clean it, write it to file, move to next string. The final task of sorting can't easily happen until all the strings are written cleanly to the file.
If you have many files to write and sort then each of these can be dealt with by a seperate thread, but I would avoid involving multiple threads in the processing of any one given file.