The rules don't say
We have a whole related question about what "light activity" means. There are some examples of each in the rulebook, which I will copy wholesale from the other question because they're very relevant:
A long rest is a period of extended downtime, at least 8 hours long, during which a character sleeps or performs light activity: reading, talking, eating, or standing watch for no more than 2 hours.
If the rest is interrupted by a period of strenuous activity—at least 1 hour of walking, fighting, casting spells, or similar adventuring activity—the characters must begin the rest again to gain any benefit from it.
Neither list mentions "flying a broom", so your DM will have to make a ruling about which category this is similar to.
Your DM might argue that flying a broom is strenuous, because there's high wind blowing on you constantly and you have to make sure the broom stays at the right altitude.
Your DM might also agree with you that flying a broom is light, because (when things are going right) you don't actually have to move, you just sit there and watch.
You should be fine regardless
Flying a broom is already faster than anyone pursuing you on horseback, especially if you're flying over difficult terrain. You shouldn't need the extra speed from flying all night.
Even if you did want to fly all night, you could just take a level of exhaustion. One or two won't kill you.