Hopefully the surgeon might sort out the AF.
Generally it's due the inflammation after the surgery if there was no AF prior to surgery. However, there is a chance the AF does not go away.
Coughing is an early sign the lungs were affected by the Mitral regurgitation - which causes blood to back up in the blood circulation in the lung - see plumbing below:
In any case, AF is common with mitral regurgitation even without surgery.
The blood plumbing in the heart:
Starting from the Left Ventricle >> Aortic valve >> Aorta >> arteries going to rest of body >> Capillaries
Capillaries >> Veins >> Vena Cava (main vein going back to heart)
Ven Cava >> Right atrium heart >> tricuspid valve >> Right Ventricle >> Pulmonary Valve >> Pulmonary artery
Pulmonary Artery >> Pulmonary cappilaries in Lungs whose main function is to absorb oyxgen from the airside of the lung and release carbon dioxide >> Pulmonary Vein
Pulmonary vein >> Left atrium >> Mitral valve >> Left Ventricle
Rinse and repeat
So Mitral regurgitation means the mitral valve is leaky causing blood to backflow into the right atrium and then pulmonary vein and capillaries.
This causes sensation of coughing, sometimes coughing with blood usually due to coughing trauma and actually not due to blood leaking out of pulmonary veins
AF means the Left atrium is beating irregularly fibrillation - hence atrial fibrillation, and not efficiently pumping blood through the Mitral valve into the left ventricle. So for the same reason blood backs up in the pulmonary veins and pulmonary capillaries.
The net effect of the backup in blood is the pressure in those pulmonary capillaries increase causing pulmonary edema - instead of blood, fluid leaks out into the air side of the lungs, or sometimes pleural effusion - fluid leaking out into the space surrounding the lungs, and often fluid in the rest of the body - typically puffy legs and buttocks. Fluid leaks out rather than blood because the capillaries act like a filter blocking the blood cells from coming out but is leaky enough to let fluid through.