How to update array fields in a table in Postgresql?
You can simply do

UPDATE my_tbl 
   SET (a1, a2) = (a1 || 123465, a2 || 132456789)
 WHERE id = 321;


To obtain a function, you simply have to replace the integer constants with the parameters.  You can safely do it in a query language (aka SQL) function, no need for pl/pgsql at all.