It's unlikely that you'd like to discard the output from the pipeline. It is more likely that you'd like to store it somewhere rather than having it flood your terminal.
I think this is what you're looking for:
$ tr '\n' ' ' < afile.txt | sed '$s/ $/\n/' >anotherfile.txt
This will put the result of the pipeline into the file anotherfile.txt rather than onto the terminal. You are then free to inspect it and to replace the original file with it (mv anotherfile.txt afile.txt) if this makes sense with what it is you're trying to achieve.
The > at the end of the pipeline is an output redirection that will redirect the standard output stream of sed into the specified file. It works in the "opposite way" of the input redirection < that is used earlier in the pipeline to send the contents of afile.txt into the standard input stream of tr.