can I work for a UK based client abroad, without a UK visa?
Yes you can. Visa's are about entering a country, not doing business with it.
Do I need to have a company to work for them, or I can keep a freelance basis?
No, you do not need a company. You can remain freelance.
Will HMRC charge me for tax or what?
The UK government can only apply taxes to it's own residents, on imports and exports or basically on anything that comes under their jurisdiction. For certainty about this, get the overseas contract, take a couple of payments, then consult an accountant in your home country. If the answer you get is not in your favor, ask another accountant. You often get different answers especially when it comes to complex affairs. Get them to write down their advice to you and you are covered. Use that accountants services for your tax affairs. Unless you are charging huge amounts of money, you only need to comply with your own countries tax laws, and HMRC will ignore you and charge the UK company if they see fit. Once overseas and no longer a resident, it should be of no concern to you.