It has been shown that there are not only transverse but also longitudinal couplings between microwave fields and a superconducting qubit with broken inversion symmetry of the potential energy. Using multiphoton processes induced by longitudinal coupling fields and frequency matching conditions, we design a universal algorithm to produce arbitrary superpositions of two-mode photon states of microwave fields in two separated transmission line resonators, which are coupled to a superconducting qubit. Based on our algorithm, we analyze the generation of evenly-populated states and NOON states. Compared to other proposals with only single-photon process, we provide an efficient way to produce entangled microwave states when the interactions between superconducting qubits and microwave fields are in the ultrastrong regime.