I would like to insert the value of a variable into a file. I have tried redirection, but it isn't working:
$HOME > file1
file1
You need to use echo to get the output.
echo
echo $HOME > file1