I have a reddish bruise on the shaft of my penis after masturbation can this be an STD infection?

Depends. If you have had sex with someone else, then any lesion on the genitalia would be concerning for possible std and would require a doctor to examine to evaluate. If you have just been masturbating only, then no, you can't conceivably give an std to yourself, and this is likely just over vigorous activity.