ValueError: too many values to unpack

Dear @Nisha_Sharma,
Please follow this forums suggestions (Read before posting: How do I get my question answered?) by posting a minimal code example, and not your full code.
Remove every line not required to produce the error message (and especially the while loop). Please do also remove all variables not used in the code.

For instance, to produce your error message, you only need to define the functions, testfunctions and trial functions used in your second PDE (A2==B2). You do not need to solve A1== B1, and should therefore remove the variational form of A1 == B1, and all variables not used in A2==B2.