In addition to the image below, always put “shield” type heroes in the front row. “Fire” type heroes go in the back row. “Cross” or support type heroes if used go in the back middle row.

This link has a good writeup on different formations. https://www.bluestacks.com/blog/game-guides/last-warsurvival-game/lws-best-hero-formations-en.html