Two-point generating function of the free energy for a directed polymer in a random medium