First you need to take out the body pins (front/back) or just the front pin depending on the brand m4 you have.
Second you need to slide the top reciever off of the lower. If your aeg is wired to the front you should have enough wire length to slide it off enough to slide the inner barrel and hopup out the space between the upper and lower reciever.
Next you need to take the small piece, on the bottum, off where the hopup and barrel meet.
Finally you need to put your new barrel into the hopup and put it back together.
Note that when you put it back together make sure the small spring outsite the hopup rests firmly in the cutout of the upper reciever so that it is seated properly.