Welcome to HCM.
Internal body temperature increases with masturbation- this is the reason you feel more hot or sometimes even sweaty after masturbating. But it will not be the temperature that you have mentioned.
Masturbation has nothing to do with the Typhoid. You are simply correlating your fever with masturbation.
is contracted by the ingestion of the bacteria in contaminated food or water. Sanitation and hygiene are the critical measures that can be taken to prevent typhoid. Other way to prevent typhoid fever is with the typhoid vaccine
There are two types of vaccine these include the live, oral Ty21a vaccine and the injectable Typhoid polysaccharide vaccine. Both are between 50% to 80% protective and are usually recommended for travelers to areas where typhoid is endemic.
Consider the above mentioned measures you will be fine.
Hope I have provided the information you needed.
Wish you good health. Take care.