How can I write files with info-beamer pi

You can’t write files or access GPIO directly from the Lua environment of info-beamer. But that isn’t a problem: info-beamer is really good at being scripted from outside too. So you can use any of the existing GPIO tools or libraries, write your logic in any programming language you like and then send commands to the running info-beamer program to control it. The simplest way is probably to use UDP packets. The idea is that you define handlers that can then trivially be called by sending UDP packets. Have a look at these example:

Have a look at the util.data_mapper function. It can be used to react to outside events inside your Lua code.