[root@localhost ~]# cat demo.txt 

[root@localhost ~]# sed -i '$a \test_fields\ntest_fields1' demo.txt

[root@localhost ~]# cat demo.txt 

[root@localhost ~]# echo "" >> demo.txt 

[root@localhost ~]# sed -i '$a \test_fields\ntest_fields1' demo.txt

[root@localhost ~]# cat demo.txt 

est_fields

test_fields1

[root@localhost ~]# 

There must be one line of content in the file, even if it is an empty line, content can be added
Cannot add content to an empty file using the sed command