A laptop is not the only device you can use to produce music. People have used phones and tablets to create pro-level music, songs that sound like they were made in a professional studio.
However, a laptop is often the best option for home producers.
The main benefit of a laptop when recording is that it can be easier to use because the screen is bigger than a mobile device, it has a lot more storage, and it has much more computing power.
Yet a laptop is still mobile, letting you record at home or easily bring it to another location.