You can certainly make that repair. But IMO, and really just my personal opinion, it's just less trouble to replace the entire cassette. The thing is, you have to make sure that the replacement is of the exact same model. I've ordered 'replacement' cogs that supposedly would fit. Dismantled and reassembled the cassette. But for whatever reason they weren't the precise thickness of the original cog and consequently made the rest of the smaller cogs just a bit out of place...and thereby making shifting FUBAR'd. Also, when I change out a cassette...I find that it's also time to replace the chain.
Dan