When I discovered a command block, I did the dumbest thing you could possibly do on minecraft pe. I wrote in a command block saying (summon dragon) repeat! So how do I get rid of a large number of dragons?
If you don't care about keeping other hostile mobs, you can just set the world to peaceful. Otherwise:
Since you can apparently use commands, you just have to enter this command into chat:
If not all dragons are currently loaded, you have to fly around a bit and repeat the command until you got them all.
That answers your main question, but you still have the problem that your repeating command block is still constantly spawning new dragons. You could open the world on a server with command blocks disabled, use NBTEdit, MCEdit or other tools, but in your case there's an easier solution:
You can just put down another repeating command block, this one having this command in it:
/tp @e[type=ender_dragon] ~ 255 ~
That teleports all dragons away so that you can go to the summoning command block and break it. It might happen that each dragon is still there for one tick, in that case, you just go near the command block and execute this command to break it:
/fill ~-15 ~-15 ~-15 ~15 ~15 ~15 air replace repeating_command_block
Then just do
again and all dragons up in the sky should be gone. Now just break the second command block and all the mess is cleaned up.
You can possibly remove the command from the command block using external tools like NBTEditor.
Here is an answer on a similar questions: https://gaming.stackexchange.com/a/212333/182734 .
Hope it helps. :)