Sum of sub-matrices

I am getting the sum as zero. So there is some error.
Pls help.

I haven’t received any help till now.
Please reply ASAP.
provide the correct code solution.

Hey, i have made changes to your code .Also,i have mentioned the error in comments.