I have been in complete doubts and frustration in regards to ghusl. If one masterbates however due to the guilt of doing he refrains and does not end up ejaculating, is ghusl required? I am well aware that this is a sin, and I’m trying my best to avoid this sin.

If no ejaculation took place, or semen discharged, then ghusl is not required.