Because the Freys have to conquer the Riverlands with 2,000 men (since they promised Roose Bolton 2,000 men to help conquer the North), which makes them rather substantially outnumbered vis-a-vis the loyalist Riverlords who would happily see them dead.
Keeping Edmure Tully, legitimist Lord of Riverrun and Lord Paramount of the Riverlands, prisoner keeps the loyalists in line, because they can’t rebel in his name when he’s securely kept and not far from a gibbet either.
Whereas killing him makes him a martyr.