Your situtation is complex and you have not provided enough information for a complete answer. The demand of the HOA may or may not be justified. However, rather than trying to do this yourself, you should hire an experienced real estate lawyer in your area. Problems like the ones that you are experiencing are inherent in ownership of property purchased at foreclosure auctions. Buyers a such auctions should expect to pay attorney's fees to correct unforeseen legal problems on such properties.
Disclaimer: This answer is provided for informational purposes only, does not constitute legal advice, and does not create an attorney-client relationship. Actual legal advice can only be provided after completing a comprehensive consultation in which all of the relevant facts are discussed and reviewed.
It appears t hat the association's conduct is unlawful, and if you get an attorney who is knowledgable about association law, it should be possible to put a stop to this conduct at some point, and very possibly to recover your legal fees from the association. However, you do not include enough information. Is it a condo association or a homeowers association ? They are different, and different laws apply. If it is a condo, the association does usually have the right to approve tenants and to approve buyers, however their withholding of approval must be legitimate, and withholding it to force you to selll to them, if that is what is happening, is not legitimate. Unfortunately. many associations have become extremely predatory and unreasonable.
You do need an attorney. However, no attorney could do a proper job of beginning the process of communicating with the association without a full understanding of what has occurred, what the association has actually said and done, and what its governing documents say. All of this takes time, and so would be a factor in the cost. Maybe the prior owner would collaborate with you to finance the cost, since it appears that he has a major interest in sorting this out as well.
Please note that the above is not intended as legal advice, it is for educational purposes only. No attorney-client relationship is created or is intended to be created hereby. You should contact a local attorney to discuss and to obtain legal advice.