You can read and write to DBFS files using 'dbutils'
Lets see one example
dbutils.fs.put("dbfs:///mnt/sample.txt", "sample content")
Above command helps to write "sample content" to 'dbfs:///mnt/sample.txt'
Now you have the file in your DBFS location. Lets see how to append content to this file.
In order to do that, you can open the file in append mode.
with open("/dbfs/mnt/sample.txt", "a") as f: f.write("append values")
Now your appended file is ready!!!