Shame on your attorney and buyer agent.
I assume you had both.
You should of been informed as to what you were buying, the obligations you have and the procedures that are involved.
All should of been spelled out in the purchase and sales agreement, security deposits accounted for.
This is Massachusetts - its a tenants state when it comes to the courts. Cross your i's dot your t's make sure you follow the law.
"Caveat Emptor" Let the buyer beware