Did Spain lose them all in a series of revolutions? Were areas fighting together and then splitting up?
May I ask if this is a homework assignment?
The biggest reason is that, as opposed to the USA and Portuguese America (Brazil), the independence of Spanish America was brought about by a number of local rebellions.
British colonists organized their grievances and later rebellion through the Continental Congress. Brazil was made independent at the stroke of the pen of a member of the Portuguese royal family (assuming control himself and creating a cadet branch of the Portuguese royal family which would rule until Brazil became a Republic).
Spanish America had at least half a dozen unrelated independence movements which never really coordinated amongst themselves to create a single independent country. The closest they came was maybe Simon Bolivar, but that was because he personally liberated Venezuela, New Granada (AKA Colombia), Ecuador, Peru, and Bolivia. Even then the country he created fragmented very quickly, leaving him heavily disillusioned and depressed.
Local elites who had successfully attained independence, such as in Rio de la Plata (now Argentina) were also unlikely to attempt to create a single unified nation-state ex post facto. This is because such a nation-state would require them losing some of their unbridled control of their locality. To return to the example of Rio de la Plata (Argentina), the country was dominated by the elites of Buenos Aires for many decades, causing those in the interior to rebel numerous times in attempts at a more equitable policy.
Central America is slightly different in that it fragmented into tiny pieces in the decades following independence. This had to do with the weakness of the central government centered in what is now Guatemala and the desire of local elites in El Salvador, Honduras, Costa Rica, and Nicaragua to exert greater control over their localities. Panama wan't a part of that because it had already joined New Granada (later Colombia) and would remain part of that country until the early 1900s. One northern province of Guatemala also chose to join Mexico right after independence before the rest of Central America fell apart.
An attempt was made, by Bolivar, to create some sort of confederation among these states, but it failed. The Panama Congress in 1826 got several countries to at least send representatives, but several important countries were missing, the congress didn't really achieve much in practical terms, and the follow up congress in Mexico the following year was a complete bust. After both congresses failed to pass an act of confederation the idea died its own kind of natural death.
So, in short, the reason that Spanish America is just a bunch of small countries is that no single, unified movement made it independent and once independence was achieved local elites (not to mention powerful veteran generals) saw few benefits in attempting to join some new country. Attempts were made to unite them afterwards but they were unsuccessful.
Everything said is correct but also think of a couple of additional things. Geography and colonial history. This means Geography itself dictated several areas to be separated, just look at Argentina and Chile separated by a big mountain range. Similarly how would you connect Mexico and Colombia, so this all means that right from the beginning the colonial lands were already divided and managed by separate officials. Later independent movements followed much of this territorial organization.