When you use single quotes, the shell will not expand what is inside them. So '#$f'
is treated as literally the string #$f
instead of being expanded to the value of $f
. Try this instead:
for f in {0..9}.txt; do
echo "Hello, this is the first line of file #$f" > "File${f}"
done
Example:
$ cat File3.txt
Hello, this is the first line of file #3.txt