ANSWER:
You should join the congregation with the intention of maghrib and after the third rakah, sit down and finish your maghrib quickly and rejoin the Imam with the intention of isha while he’s still praying his isha and after he concludes, you get up and continue your isha.