Pocketing balls is a great first step towards learning billiards, but running out racks takes much more.
First, you need to be able to position the cue ball where you want. You should practice shots until you are comfortable shooting with different speeds and spin on the cue ball, in order to gauge where the cue ball will land after pocketing a ball.
Second, you need to make a plan to runout by linking shots together. Start working your runout backwards from the last shot you will make to the first shot in your run. Select shots that can position the cue ball for other shots until you see the best way to run all the balls.
Third, adapt to shooting errors that you make. Unless you are a world class player, you will make mistakes that affect your plan to runout. Instead of getting frustrated, look at the mistake as a learning opportunity. Practice the shots you missed and the positioning errors you made until you master them.