A plan to restructure Thames Water through a loan of up to £3 billion should not have been approved as its terms are “mispriced and inappropriate”, the Court of Appeal has been told.