Вы можете использовать следующий код для добавления содержимого в файл:
String fileName="/home/shriram/Desktop/Images/"+"test.txt";
FileWriter fw=new FileWriter(fileName,true);
fw.write("here will be you content to insert or append in file");
fw.close();
FileWriter fw1=new FileWriter(fileName,true);
fw1.write("another content will be here to be append in the same file");
fw1.close();
вы можете пропустить расширение php php-gd
, попробуйте установить его с помощью sudo apt install php-gd
или sudo yum install php-gd
или любым другим способом, подходящим для вашей ОС или метода установки