Generating Functional for the S-Matrix in Liouville Theory