How to merge to codes and let them function sequentially

Why are you using software serial on a mega with FOUR serial ports ?