Anvil allows you to write to text files, and you can do it if you need to work with a library that works with files, but the files are temporary and can disappear between two server calls. Even worse: the same server function called twice might be executed in two different servers.
If you want data to persist between calls you need to store in a table.