If in the middle of shmonei esrai someone gets a cough attack where he’s embarrassed and/or he’s worried it will be disturbing other people davening, can he walk outside in the middle of his amidah?
Before addressing your question, Hashem should send you a refuah shleima and heal your cough.
Regarding your question, if you have to cough do so, but you shouldn’t walk outside because of it. The coughing fit will IY”H pass after half a minute or so, and then you can continue davening. In the rare situation that you know beforehand that you will have a long coughing fit and it will disturb others, I would suggest that you distance yourself before starting to daven.