how can I inform my resignation and avoid telling my boss about company A?
Like this. You write this on a piece of paper:
Dear Mr./Ms. Manager:
This is my formal notification that I am resigning from (company name). (Date) will be my last day of employment.
Sincerely,
(your name) (today's date)
and hand it to your manager. Notice that Company A was not mentioned.
If anyone asks any nosy questions about your personal life such as where you intend to work next, then the answer is:
That's a personal matter that I'd rather not discuss.
If they ask again, say it again. This can be surprisingly difficult, so practice.
(Note that this applies to more situations than just the one you're in.)
Now, if they ask a question that pertains to the business, such as:
Have you signed an offer letter from another company?
then you answer the question truthfully. Many companies have entirely reasonable policies that employees who have signed an offer letter with a competitor are security liabilities. (Whether you have to volunteer that information depends on your agreement with your current company; read your employee handbook.)
It ought to go without saying but I'll say it anyway: Be prepared to be escorted out of the building by security at any moment after you announce your intention to resign. Make sure your personal items are already cleared out or nothing you wouldn't mind leaving behind.
Another thing that ought to go without saying: if your current company asks you to sign anything other than your resignation letter or your final paycheque, do not sign it. Some companies will suddenly produce a noncompete agreement on the day that you're leaving that they "forgot" to ask you to sign on your first day.
They are not in a position to get you to do anything; they can't legally withhold your pay, and threatening to fire you on your last day seems ineffectual. If they pressure you to sign anything, the right response is:
I do not sign anything without my lawyer's approval.
And if they ask you who your lawyer is, well, you already know the answer to that nosy personal question.
I was hoping someone could give me a solution on how to avoid the question altogether
Like this. You write this on a piece of paper:
Dear Mr./Ms. Manager:
This is my formal notification that I am resigning from (company name) effective immediately.
Sincerely,
(your name) (today's date)
and hand it to your manager. Then you turn and walk out of the building.
Alternative solution: do something that gets you fired. Ideally try to find something that gets you fired immediately but not arrested. Since you have been fired there's no need to resign, and no one is going to ask you where you're going next.
Neither of these solutions are very professional. I'd go with not trying to avoid the question and simply refusing to answer it.