Try this, minimally tested. It selects every object in the drawing, and loops through them. It extracts the layer. If the layer name contains a "B" and a matching "A" layer is found it changes the objects layer from "?.B" to "?.A". It takes no account of locked layers or layers that may have an additional "B" in them.
(vl-load-com)
(defun rh:lyrxist ( lyr char / n_lyr rtn)
(setq n_lyr (vl-string-subst char "B" lyr))
(if (not (tblsearch "layer" n_lyr))
(setq n_lyr nil)
);end_if
(setq rtn n_lyr)
);end_defun
(defun c:B2A ( / *error* c_doc)
(defun *error* ( msg )
(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
(if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred.")))
(princ)
);_end_*error*_defun
(setq c_doc (vla-get-activedocument (vlax-get-acad-object))
c_lyrs (vla-get-layers c_doc)
);end_setq
(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
(vla-startundomark c_doc)
(setq ss (ssget "_X"))
(vlax-for obj (vla-get-activeselectionset c_doc)
(setq o_lyr (vlax-get-property obj 'layer))
(cond ( (and (wcmatch (strcase o_lyr) "*.B")
(setq n_lyr (rh:lyrxist o_lyr "A"))
)
(vlax-put-property obj 'layer n_lyr)
)
(
(princ (strcat "No matching Layer found for " o_lyr))
)
);end_cond
);end_for
(setq ss nil)
(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
);end_defun