This is definitely a way to help reduce your risk for getting or giving HIV, as less fluids exchanged means less HIV risk. Unfortunately, the withdrawl method (pulling out before cumming) doesn't protect you from pre-cum. Even small amounts of pre-cum contain HIV and can cause an infection.
Also, the withdrawl method doesn't protect you from the guy who says he's going to pull out before cumming, but then doesn't.
Ultimately, pulling out before cumming helps reduce your HIV risk. But it's not going to eliminate your risk. Nor is it going to protect you from STDs that don't require cum to be transmitted, such as syphilis, gonorrhea, chlamydia, genital warts and herpes.