Complex sentence: For the rest of his life he commanded a regiment of black militias, but did not fight in the Battle of Pavón, forming part of the defense of the city of Buenos Aires.
Split into simpler sentences: For the rest of his life he commanded a regiment of black militia, but did not fight in the Battle of Pavón. Instead, his regiment formed part of the defense of the city of Buenos Aires.