The villain so far has only appeared in two chapters. However now he's making a return in a chapter which is mostly about him, his actions and his past. Now. What are mistakes I should avoid when writing a villain, one that'll play a role till the end?
Avoid making him a caricature. Don't make him villainous simply by having him espouse a caricature of political ideas you oppose. Remember that no one thinks of themselves as a villain. He is a human being with an agenda that is opposed to, or incompatible with, the agenda of your hero. He has fully justified his agenda to himself and therefore feels justified in his actions. His actions may be cruel, but there is a reason for them that makes sense to him. Portray him like that, and be just as careful to keep his actions consistent with his character and motivations as you would with you hero.
I second @Mark Baker's answer: Make sure he's not a caricature of villainy. Motivations are critical: Give him motivations that make sense for the story and the characters in it. If he's going to oppose your protagonist (and that's what he's there for), make sure he either wants the same thing for his own valid reasons, or he's pursuing something that causes him to go directly against your protagonist's goals.
I'd also add, make sure he's the hero of his own story. Internally, what he's doing should appear right, good, correct, or whatever, even if it's not in the eyes of the rest of the world.
Like @Mark Baker says, make him a person, with real reasons for doing what he does. Those actions only have to make sense to him, but if you write the character believably and consistently, his madness, obsession, weirdness, or just his reasons for going against your protagonist, will make sense to the reader, even if in reality don't.
Hope that helps some.
Ditto @Mark Baker and @josh.
I see lots and lots of villains in stories who I find totally unbelievable because they have no coherent motivation. The worst are those Hollywood villains who scream, "I shall destroy all that is good and right and true!!" and then bursts into insane laughter. Think of even the worst real-life villains. Hitler and Stalin didn't boast that they were fighting goodness and truth and laugh maniacally. No, Hitler said things like, "Germany was betrayed by the Jews, and we must take steps to protect ourselves from these dangerous people." Stalin talked about the need to stop the greedy kulaks from exploiting their neighbors. Etc.
I've read lots of stories where the explanation for the villain's behavior is that he has some extremist religious belief, sometimes a made-up religion, sometimes supposedly based on a real religion. Except 90% of the time the religion is silly nonsense that no one in the world really believes. And if you're an atheist and your response to that sentence is, "But all religion is silly nonsense that no rational person would believe", you need to take a step back. Ditto if you say, "But all Republicans/Democrats/socialists/Teabaggers/hippies/whatever believe utter nonsense that no rational person would believe, so of course their motivations and actions don't make sense." You just don't understand people well enough. Even the people I think are craziest almost always have an internal logic that makes sense to them. They don't do evil things at random for no apparent reason. When they do evil things, it's usually because they honestly believe that they are serving a greater good. Their beliefs may not make sense to me, but they're usually not random and incoherent.
Of course when villains give a justification for their actions, maybe they really believe it and maybe it's just an excuse for selfishness. But selfishness is a comprehensible motivation.
I once heard to make him emphathizable, even if it is just once. A human who can hurt others is scarier than some super-powered god. Make your audience hate to love him and love to hate him.
Also make him more skillful than the hero so that the hero can grow over the course of the book(s) and finally defeat him at the end. Some examples of this are: Harry Potter( Voldemort is much more skilled than Harry at the beginning, but at the end, they are about equal.) the Matrix (Neo isn't strong enough to defend himself against Agent Smith... Until the very end of the first movie.). And so on.
It depends on what you're after. Sometimes, less is more, and not every villain need be hyper-nuanced. Sometimes, being unapologetically selfish is a perfectly valid motive, however, I would try to make them human even if they're most definitely selfish.
While most ideological villains are the hero of their own story, consider their actions justified, plenty of villains ain't like that.
A good way to look at it is to observe everyday petty villainy from people. Sometimes there's a clear rationale behind it, sometimes people are just pricks. For example:
A low-income man has an ill daughter in a country that doesn't provide free-at-point-of-delivery healthcare. He therefore supplements his income by mugging richer people than himself. To him, he's definitely the hero; he's just doing whatever he can, the law be damned, to save his daughter.
Another low-income man has a wife that he regularly beats the crap out of, then sells her a patter about how he's sorry, and why'd she have to make him hit her, all that stuff, keeping a woman in a cycle of abuse because he wants a toy to take out his sadism/anger on. This guy probably knows on some level what he's doing is wrong, and just doesn't care.
The latter case could easily be a really simple villain; this guy, if he was high income, would probably be the sort to kill prostitutes with impunity and relish in the relative immunity from the law his class has.
Just remember that amid all the pressure writers have these days to make 'nuanced' characters that sometimes, people are unapologetic, selfish assholes.
Not necessarily 'avoid', but be aware of the tropes you're using when describing a villain's appearance/ behaviour. Does he have a large/hooked nose? That's a trope that stems from antisemitism. Is he dark skinned? Gay? Trans? These aren't charcteristics that you can't ascribe to a villain, but avoid making him the only person representing a particular group in a story (especially if it's longer).