Lots of options:
1. Tie the ends together.
2. If there is not enough room then butt the ends together and sew the ropes together
How to Replace Halyard Rope - Sailrite ...get a needle and polyester wax thread and sew the ends together then tape the ends.......
that is what I do and works everytime......kind a PITA.
3. OR Whip each line line together and tape them
4. OR use a special hook to attach to each end and tape it.
For each option give it a test pull just to make sure they are secure and will not disconnect.
If you do an internet search on "replacing a main halyard" you will find many YouTube videos on how to attach a tag line.