I have cat table in a2 database I want to insert into id, img columns from different tables with different database
INSERT INTO a2.cat (id, img) SELECT i
I think you need to look into using a JOIN for this:
JOIN
INSERT INTO a1.cat (id, img) SELECT p.id, pi.name FROM topshop_test.product p JOIN topshop_test.product-images pi ON p.id = pi.productid
This assumes the product-images table has a productid field that links to the product table.