Romeo cries out these words when the full impact of what he has just done, and the consequences to be suffered, strikes him. His secret marriage to Juliet of the Capulet family, his own family's sworn enemy, had earlier prevented him from accepting the challenge of a duel made by Tybalt, Juliet's cousin. Romeo's friend Mercutio cannot stand by and watch Tybalt degrade Romeo, and so he takes up the sword, but is fatally wounded. In a dizzying cloud of grief, Romeo picks up his sword and attacks Tybalt ferociously, killing him. It is when Tybalt falls dead that Romeo realizes what he has done. He also knows he will now be executed (or banished) by the Prince, who had decreed that there would be no more battle between the Capulets and the Montagues. (from eNotes. See link below)
This is the reality of what transpired. Could he have done anything differently? From the start, yes! He could have curbed his tendencies toward romantic flights of fancy (remember how he mourns for Rosalind in 1.1 and ten mins later is in love with Juliet?) He could have tried to work on Juliet's parents and mend the relationship with the families in order for them to co-exist peacefully. But most of all, he could have curbed his temper. He kills Tybalt and eventually himself in rash outbursts.
Romeo, to put it bluntly, needed to grow the heck up.