“The south wanted to keep the institution of slavery. They were rightfully defeated.”
If the South was fighting for slavery, who was fighting against slavery?
After January 1 1863, Every slave in those states in rebellion against the United States became de jura free. Where ever the Union Army went after that date, slaves became not only de jura but de facto free persons. By the end of the war, the Union Army freed about 3 million slaves.
Does that give you an idea of who was fighting to end slavery?
The north.