Conditonally create temporary table
You do not need a function to check if the temporary table exists. You do not even need the table. The query below gives all tables settings in all schemas (except of public and system schemas) in a database, with appropriate schema names:

SELECT table_schema, table_name
FROM information_schema.tables
WHERE 
    table_type = 'BASE TABLE' 
    AND table_name = 'settings'
    AND table_schema NOT IN('information_schema', 'pg_catalog', 'public')


In the anonymous function below we shall build sql query instead of storing results in a temp table, according to the following pseudocode:

for all tables 'settings':
    build select query text and store it in 'vselect',
    append 'vselect' to 'vquery' joining consecutive selects with word 'UNION'


At the end of the loop we shall have in vquery something like this:

SELECT 'schema1', prefix, id, value FROM schema1.settings WHERE id = 'VERSION'
UNION
SELECT 'schema2', prefix, id, value FROM schema2.settings WHERE id = 'VERSION'
-- etc


and we are going to use this in COPY to a file.  

The function:    

DO $$
DECLARE
    vrec record;
    vquery text = '';
    vselect text;
BEGIN
    FOR vrec IN
        SELECT table_schema, table_name
        FROM information_schema.tables
        WHERE 
            table_type = 'BASE TABLE' 
            AND table_name = 'settings'
            AND table_schema NOT IN('information_schema', 'pg_catalog', 'public')
    LOOP
        vselect = format(
            'SELECT ''%s'', prefix, id, value FROM %s.%s WHERE id = ''VERSION''',
            vrec.table_schema, quote_ident(vrec.table_schema), vrec.table_name);
        IF vquery = '' THEN vquery = vselect;
        ELSE vquery = format('%s UNION %s', vquery, vselect);
        END IF;
    END LOOP;
    EXECUTE format('COPY (%s) TO ''/tmp/out-%s'' CSV', vquery, current_database());
END $$;