It is well known that you cannot use the same file for input and ouput in the same command. For instance,
$ cat header.txt body.txt >body.txt
doesn’t do what you want. By the time cat reads body.txt, it has already been truncated by the redirection and it is empty. The final result will be th...