Would it be wise to punish students for bad behaviors by having them write essays?

It would depend on the student, what they had done and why they had done it. It could potentially work for students who were continuously badly behaved as they probably wouldn't enjoy writing lots of essays! However, for students who have only been bad once it is probably not the best of ideas as they may have simply made a mistake.

I remember my days in high school when I made 1 or 2 mistakes and the thought of being in trouble with my parents was enough to persuade me not to make the same mistakes again! Making me write essays would not really be that much of a punishment as it would not discourage me; it was my parents reaction!