Ouch. Did you have any pain? Our anus is a tender area and I'd be careful with that. You also want to be very careful of hygiene. Mixing anything from your anus near your vagina or clitoral can result in transference of bacteria and UTI's or infections. So, just really be careful. (this is why we wipe from front to back verses back to front as well). Okay, re reading what you wrote. You were masturbating vaginally and had blood on your anus. Okay, yes. That could have been it just moving there from your vagina (and maybe you hurt yourself during vaginal masturbation (our cervix is very vascular and we can get a bleed if we aggravate that) or you starting your period during it, etc. If you continue to have blood from your anus, you need to see a doctor right away. Is it from masturbation of the vaginal area? No, probably not, but still needs evaluation.
Unless the discharge was something else from your anus and mixed with blood from masturbating that came from your vagina, it doesn't seem like the two things would be connected. You might have eaten something that gave you the bloody discharge or even have hemorrhoids.