To check that A and B belong to the field F:
sage: A in F
True
sage: B in F
True
sage: A in F and B in F
True
Elements of F are polynomials in the generator a with coefficients in GF(3).
Here a satisfies the relation a^3 + a + 1 == 0 due to the choice of modulus in the definition of F. So, to get all elements of F it suffices to take polynomials of degree less than the degree of the modulus, i.e. of degree less than 3. (This is because any higher degree polynomial in a can be simplified to one of degree < 3, using the relation a^3 + a + 1 == 0.) This explains why you only get (all) polynomials of degree less than 3 in a when you enumerate(F).
Since A and B are defined as polynomials in a, they automatically belong to the field F. You can even define, say, C = a^5, and it will also belong to F. Using the relation that a satisfies you can see that C == a^2 + a + 1.
Changing the numbers doesn't make your question any clearer. Please clarify with words what you want to know / what you are asking for.
what is the sage command to check A and B belongs to the field F.