To change a road bike groupset, you need to swap all the components a groupset consists of, such as front and rear derailleurs, shifters, cassette, crankset, chain, brakes, brake levers, and the bottom bracket.
If you wish to do this, it’s best to buy the entire groupset as a package as it will cost you much less than buying each part separately. If you’re not skilled mechanically, it’s best to let professionals do it for you.