[tex]g(x)=ax+b\implies g(g(x))=g(ax+b)=a(ax+b)+b=a^2x+ab+b[/tex]
You have [tex]a^2=9\implies a=\pm3[/tex], and [tex]ab+b=28[/tex]. If [tex]a=3[/tex], then [tex]3b+b=4b=28\implies b=7[/tex]. If [tex]a=-3[/tex], then [tex]-3b+b=-2b=28\implies b=-14[/tex].
So the possible pairs are [tex](3,7)[/tex] and [tex](-3,-14)[/tex].