Trying to redirect a command output to an already existing file will fail

echo "hello" > output
echo "world" > output #file exists: output

cat output # hello

to solve this use >| to overwrite the file completely

echo "hello" >| output
echo "world" >| output

cat output # world

or use >> to append to the file

echo "hello" > output
echo "world" >> output

cat output # hello\\nworld

use >>! to create the file if it doesn't exist initially

echo "hello" >> output # will fail becasue the file doesn't exist
echo "hello" >>! output # will create the file and append to it 

cat output # hello