File writing can be found in the dot net System.IO classes.
Transferring back to your desktop machine will be the tricky part. You might want to use a web server with HTTP file upload as the middleman. Though if you’re doing this as a one-off, you can probably hard code your desktop’s IP address and open a listening socket on some random high port, and have the Unity app send to that.
Unless you jailbreak the phone, there’s no easy way to get a file off it.
If you’re doing this as a one-off (i.e. an experiment you are doing, not as part of a game you are distributing) just run a socket server on your desktop PC, and send the data over a socket to it.
In your Unity app, connect to that socket server using the System.Net.Sockets.Socket. A sample of that is here: System.Net.Sockets.Socket Class
However, if you jailbreak the phone, you can use the “Disk for iPhone” FUSE module to mount your iPhone to the desktop as a USB file device, and browse to your app’s /Documents directory, and copy the file from there.