First you let player choose 2 hero, I skip this part.
Now your player has first hero on F1(most top left), second hero on F2(top left under first hero).
Use 2 unit variables for heroes, (I am assuming their names are FirstHero and SecondHero) and a boolean variable with name FirstHeroSelected(set this to true at map initialization, or initial value true).
When a player selects his second hero, if FirstHeroSelected equal to true, give all items of first hero to second hero and set second hero's exp to the same amount of first hero.
The above thing also applies for other way.