Quite often a brand new master cylinder needs to be bench bled before install. You can try it on the bike but it's easier off. When mounted the hose from the reservoir to the M/C has a bit of a high spot that traps an air bubble. Make bleeding a PITA.
When I Added a rear disc brake the only way I could get it bled was to remove all the parts. Hold the reservoir up so the hose is straight, clamp the M/C in a vice. Fill reservoir, without the hose hooked up cover the hole with a finger tip. Now slowly pump the M/C. As the piston pushes out any air gets pushed past your finger tip. Your finger tip seals as the piston returns keeping air out. After a few pumps fluid should come out. This is the bench bleed.
To can now install or do as I did.
Once fluid comes quickly hook up the hose. Hold the hose up, Seal the hose with a finger and thumb. Pump, until fluid gets that far. Add the next thing to the hose. Eventually you will get to the caliper.
With it all bled, don't take anything apart and install on the bike.
You can try doing this on the bike but that high spot will make it tough. Once Bled as I mentioned and installed the hose won't have an air spot to try to bleed out.
Once done this way you can drain and flush refill with out any problems. Just pump out the old fluid and keep the reservoir full. Do the drain flush and refill this way and it takes about 1/2 to 3/4 of a pint.
Leo