Generating functions of stable pair invariants via wall-crossings in derived categories