Replacing a rear suspension unit on a bike is usually a very easy job.
It is held in with just two bolts: one at the front, and one at the rear.
Undo these bolts – you may need both allen keys and spanners, and slide them out. Sometimes they get a bit sqaushed and seat very firmly in place, so you might need to tap them through lightly with a hammer/alternative.
Once the bolts are out, the suspension unit should simply lift away.
Put it’s replacement in the slot making sure it’s the same way around (stanchion to the rear), and slot the bolts through.
Tighten the bolts back up (nice and tight! This thing’s holding you up, remember!) and that’s it!