Formation and migration of trans-Neptunian objects