Given that,
Mass of block A =4kg
Mass of block B =5kg
Now, when the blocks move together the acceleration will be same.
If f is the force of friction between A and B
Then,
F−f=mBa....(I)
Now, we know that,
f=ma
a=fm
a=124
a=3m/s2
Now, put the value of a in equation (I)
F−12=5×3
F=15+12
F=27N
Hence, the force is 27N