I'd say step one, start looking for another job. Even if you got away with refusing to go along, or negotiated your way out of it, or whatever, you now know that the boss is a dishonest and corrupt person. If he cheats to get his kids through school, maybe he'll cheat to pass safety rules. Maybe he'll cheat you out of your retirement funds. Etc.
I don't know where the victim in this story lives. In the US, getting a reference from an employer is pretty much a non-issue these days. Companies are very reluctant to say anything about former employees beyond hard, verifiable facts, like the date the employee worked there and job title, for fear of being sued. (If they say something bad about you, you can sue them for libel. There's no gain to the company to take the risk. How does it help them if they prevent their competition from hiring a problem employee? From a cynical point of view, the more bad employees the competition gets, the better for them.)
The legal situation and customs in other countries may well be different. Still, surely every country has some number of dishonest business owners. If you told a potential future employer, "I had to quit because the boss demanded I do his kids' homework for him", I'd think any rational employer would take that into consideration. And of course I then wouldn't ask for a reference from that employer, I'd ask for references from previous employers. Whether that's practical depends on whether you had a compare job before, and how long ago that was. (If you've been at this job 20 years, yeah, a reference from an employer from 20 years ago might not be worth much.)
You might try talking to the boss, pointing out how this is not helping his children.
(a) They can't cheat their way through life all the time. Sooner or later they will hit a situation where they have to stand on their own feet.
(b) The odds are that they'll be caught at this eventually. I had a prof in college who commented once that it was easy to spot the students who cheated: the work they turned in was inconsistent with what they said in class. I'm sure this doesn't work 100%: someone might write well but get nervous and stammer and lose his train of thought when speaking, etc. But the teacher doesn't have to take it as proof. Once he has grounds for suspicion, he can investigate. Take the student aside one by one and ask him to explain something he said in a homework paper, make him take a test in the teacher's office under circumstances where he cannot get any help, etc.
(c) He is teaching his children that cheating and exploiting others is acceptable behavior.
But frankly, I would not have a high level of confidence that such a conversation would change his mind. He MIGHT say, "Zounds, you're right! I shouldn't be doing this!" Or he might say, "Hmm, very good points. You've given me a lot to think about. Now write this term paper for my kid like I told you to or you're fired."
I see others have suggested telling school officials about this, or threatening too. You certainly could. I'd say there's a good chance that would get you fired. In any case, if he did fire you over this, you might well have grounds for a lawsuit. I'd talk to a lawyer about that angle. If he's been demanding this of many employees hopefully at least some of them would corroborate your story in court. You might also agree to do this once, do one homework assignment, keep a copy, and then when you go to court, get the teacher to testify that, yes, the child handed in that exact same paper. But a lawyer would be better able to advise you on what you can do legally and what sort of evidence would hold up in court.
BTW I'd say there's a difference between something like this, that I'd call unethical, and something grossly immoral. If my boss demanded that I kill someone, that would be a whole different category.