touch sample.txt
echo "this is line one" > sample.txt #adds this as first line
echo "this is line two" >> sample.txt #appends the line to sample.txt
#if you do echo "this will remain alone" > sample.txt
# it will rewrite the sample.txt file with the string passed above