To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum
Your code is too long for me to study quickly without copying to a text editor.
Also use the AutoFormat tool to indent your code for easier reading.
This Simple Merge Demo may help.
Before trying to merge the programs go through the two of them carefully to make sure they are not both trying to use the same resource - for examples an I/O pin. If you find conflicts change something in one of the separate programs and make sure it still works with the change.
...R