Here is how AI handles two lines of infantry:
Having single long line would mean most of AI forces would be way too far to be relevant until they would get close, this way, when first line is defeated, second one just comes forward and continues fighting. In this particular battle i used three lines, with the third forming a flanking force after enemy line was engaged, anyway AI reformed its routing units multiple times, so eventually it was quite a close call battle.. (having second line means when first line routes, second fights, so first line has time to reform, regain its morale and come back when ready..)