I have this purple vein going up the right side of penis shaft. What is it for?

Blood return. This is normal and a part of how you were made. Leave it alone. Some men/boys have a more prominent vein system especially with erections. Just don't bother it. Do your natural things and leave things as they are.
Penis. Veins are rather large on the shaft of the penis and is normal.
Venous blood drain. Male patients will vary in the appearance of the veins on the penis. Some may have very pronounced veins that run the length of the top or side of the penis. Aside from being cosmetically different, they are performing the normal function to drain blood away from the penis.