These sediments can then be transported and deposited elsewhere, and over a long period of time, they can be compacted and cemented together to form sedimentary rocks.
So, while weathering and erosion don't create the rock itself, they are crucial steps in the formation of sedimentary rocks.