This will be because the file does not end in a \n
.
hexdump -C file
00000000 73 70 61 5f 49 50 3d 31 37 32 2e 31 37 2e 31 30 |spa_IP=172.17.10|
00000010 30 2e 31 32 31 0a 73 70 61 5f 49 50 3d 31 37 32 |0.121.spa_IP=172|
00000020 2e 31 37 2e 31 30 30 2e 31 32 32 |.17.100.122|
Note the file ends in 0x32 which is ASCII for 2
When you append to it it becomes
hexdump -C file
00000000 73 70 61 5f 49 50 3d 31 37 32 2e 31 37 2e 31 30 |spa_IP=172.17.10|
00000010 30 2e 31 32 31 0a 73 70 61 5f 49 50 3d 31 37 32 |0.121.spa_IP=172|
00000020 2e 31 37 2e 31 30 30 2e 31 32 32 61 70 70 65 6e |.17.100.122appen|
00000030 64 0a
Note that as you have observed the 122 runs straight into the append 122append
To fix your 'problem' you need to
echo -e "\nappend"
to add the missing \n
.
hexdump -C file
00000000 73 70 61 5f 49 50 3d 31 37 32 2e 31 37 2e 31 30 |spa_IP=172.17.10|
00000010 30 2e 31 32 31 0a 73 70 61 5f 49 50 3d 31 37 32 |0.121.spa_IP=172|
00000020 2e 31 37 2e 31 30 30 2e 31 32 32 0a 61 70 70 65 |.17.100.122.appe|
00000030 6e 64 0a |nd.|
Now there is a .
between the 122 and the append which represents the 0x0a (ASCII line Feed) character.