A very simple idea that usually works is just to take parts of the melodies of the songs you want to mash up (like 2-4 bars, or maybe just 1-2 phrases) and glue them together into a new melody that flows nicely. So take 1-2 phrases from song A and put them in your track, follow that by 1-2 phrases from song B, then 1-2 phrases from song A again, etc. It will help if you puzzle out a structure that makes sense (e.g. use 2 phrases from each song from the verses, and 2 other phrases for the chorus).
Or, what you could do, is take part of the melody from song A and use that as your verse, and use part of the melody of song B and use that as your chorus. A bit simpler, but can be very effective.
At the end of the day it’s just playing around with it, messing with it until you have something that sounds good. Anything goes, no clear cut recipe. Just gotta try and try and try and eventually you’ll have something that works.