Can I use `base/pgsql_tmp` directory for non-admin applications?
Question 1:

It is a bad idea to create these files in the PostgreSQL data directory.  That is for database files only.  In addition, you cannot be certain that pgsql_tmp is there at all (it is only created when the first temporary file is written).

Use an absolute path and write the file somewhere else, ideally in /var.

Question 2

Of course there is a risk to fill up the file system - either through the files that you write, or through temporary files that the database writes.

Question 3

That is up to your code; the database does not guarantee that you don't write over the same file in two concurrent transactions.