O redirecionamento de saída pelo shell limpa o conteúdo do arquivo antes que o comando sort
seja executado.
De man bash
:
Before a command is executed, its input and output may be redirected using a special notation interpreted by the shell. [...]
Redirection of output causes the file whose name results from the expansion of word to be opened for writing [...]. If the file does not exist it is created; if it does exist it is truncated to zero size.