List the reasons why you like group A and group B respectively. Tell them your dilemma and let them know your capabilities and skills definitely will put asset for both organization and the company. Meanwhile, tell them you hold great passion to work for this company no matter which group you will eventually join in. Basically, you write a letter to tell them the reason you didn't speak out which group you wanted is not that you had not ability to make decision, is that you like both and hardly to reject either of them. Show your confidence and your passion in your letter. Don't let them know you desperately need a job. Present them that you don't just look for job, you are looking for your career and you believe your career will start from either of these two positions.
My two cents. Hopefully it will help and welcome others give inputs.
good luck