Sending email to editor about reason of rejection of paper
It is not the editor’s job to give you advice on how to improve your paper or where to submit it. And it is the editor’s job to do lots of other things, which usually keep them pretty busy. So at the very least, you’d be imposing on them by contacting them with such questions. You might get lucky and get some advice, but be aware that you are essentially betting on the editor being willing to spend time answering a question from a random person they don’t know and whose question they have no professional obligation to answer. If you lose the bet (or even potentially if you win the bet) it might not leave the best impression.

As a general rule, it makes more sense to discuss these sorts of questions with your adviser, a mentor, or a colleague you are on friendly terms with.