At school, we were playing football and I was quarterback. I'm not really good at football so I took off, and then I threw it while running.
They said it didn't count but I think it does. Can the quarterback pass while running or not?
Rulesets for American football generally permit a single forward pass, which may be made at any time until the ball has passed the line of scrimmage (that is, the line where the ball started, not where the players have ended up afterwards).
There is typically no rule against the quarterback (or any other player) from being in motion, in any direction, while making this pass, nor does any restriction tend to exist for a player making a backward pass.
This presents three potential situations with different solutions.
Your school peers have instituted a rule such as "quarterback can't run". In the school setting, this mandates a pass, making the game fairer and involving more players each time. Solution: learn the rules for your schoolyard, possibly by having them recorded, and follow them.
Your school peers play by the "normal" rules but have got this one wrong. This has the same effect as situation 1, except with higher likelihood of debates and arguments. Solution: ask them to show where this rule exists, and if not, logically it can't apply, unless they make it explicit that this rule has been adopted for this schoolyard i.e. turn it into situation 1 and then apply solution 1.
You had already passed the line of scrimmage, and misunderstood their correct application of the rules. Solution: ask them exactly what rule you broke, and confirm which situation you are in. If it is not situations 1 or 2, pay attention next time to be sure you haven't broken a rule you know.