Awesome! If Atom A gets an extra electron, it has $$8$$ electrons in its outermost orbit. If Atom B gives up its electron in the outermost orbit, its new outermost orbit has $$8$$ electrons.
So, if this "transfer" of electron happens, both Atom A and Atom B will have $$8$$ electrons in their outermost orbit. As that is the goal of atoms, both atoms will try to get into this situation.