Is the soldier sinning when he kills in war?

No, soldiers killing in warfare is not sin.  Soldiers killing in warfare is justified homicide, according to the Holy Bible.  This is clear, particularly in the books of Exodus, Judges, Joshua, Gospels, Romans, Revelations.

The Bible does not consider as sin killing by soldiers in warfare.  This means that soldiers who kill in warfare do not need to repent for killing.  You should only repent for sins, and killing in warfare as a soldier is not sin.

In other words, both soldiers fighting for the South and the soldiers fighting for the North during Civil War did not commit sin when they killed in warfare.  Killing as a soldier in warfare is not sin.