I don't think it's possible with
echo
command, use the following
sed
approach instead:
sed -i '$ s/$/abc/' file.txt
-i
- modify the file inplace
$
- indicate the last record/line
s/$/abc/
- substitute the end of the line $ with substring abc (for the last record)