Let us assume I have a function F that takes say degree 1 monomials to degree 2 monomials and degree 3 monomials in variable x,y (example: multiplication by $x+y^{2}$). I have a basis for degree 1 monomials given by x,y; a basis for degree 2 given by $x^{2},xy,y^{2}$, and a basis for degree 3 monomials given by $x^{3},x^{2}y,xy^{2},y^{3}$. So if I want to express F as a matrix, I can say g1= F(x), g2=F(y).
Then the first row of my matrix will be coefficient of $x^{2}$ in g1, coefficient of $xy$ in g1, coefficient of $y^{2}$ in g1, coefficient of $x^{3}$ in g1, ...., coefficient of $y^{3}$ in g1. The second row will just be the same with g1 replaced with g2.