To form the basis, consider the equations you have regarding some [tex]A[/tex] a magic square, denote [tex]x_i = a_{1i} \in A \quad 1 \le i \le 3[/tex] and [tex]x_i = a_{2i} \in A \quad 4 \le i \le 6[/tex] and so on, then:
[tex]x_1 + x_2 + x_3 = x_4 + x_5 + x_6[/tex]
[tex]x_1 + x_2 + x_3 = x_7 + x_8 + x_9[/tex]
[tex]x_1 + x_4 + x_7 = x_2 + x_5 + x_8[/tex]
[tex]x_1 + x_4 + x_7 = x_3 + x_6 + x_9[/tex]
[tex]x_1 + x_2 + x_3 = x_1 + x_4 + x_7[/tex]
If you play with these equations for a bit you can get the basis matrices.