If you want to publish a lot of (scholarly) papers you need a lot of novel/new/interesting results. To get results you need (a) a lot of ideas and (b) a lot of hard work to develop those ideas.
If you are lucky then maybe a third of your initial ideas will end up in a result that is interesting enough to publish. Some of the ideas will be so easy to develop that they aren't worth publishing. Some of them will be so hard that you can make no progress in a reasonable amount of time.
To have a lot of ideas you need a firm foundation in your field, both what is known and what isn't yet known, but worth knowing if it could be arranged. Probably you won't be able to find those ideas yourself, or not very many of them, so you can work with other people who have ideas and with whom you can develop synergistic relationships to explore the unknown corners of your field.
To become a writer, you need to write a lot (as user henning suggests in a comment), but it takes more. You need to learn what is worth writing about first.
Since you are unlikely to know everything, or why some things are important or not, you need feedback on your work (and your writings). This is one of the reasons for having an advisor. He or she should be both a source of ideas and a sounding board for the ideas you have and how you develop them. So build a strong relationship with your advisor.
Another source of idea will be any state-of-the-art lectures that you can attend and any recent papers that explore ideas but leave some questions unanswered.
So, work with a lot of people. Listen to them and read what they write. Try a lot of things, expecting to leave much of it on the floor. Get a lot of feedback. Give out ideas as well as receive them. Make ideas your currency. Work hard. Take a lot of notes so that when something doesn't work out, but might later, you have a structured way to remember what you did earlier.
Always have something with you to read. Always have the means with you of writing down a quick note on an idea.
Papers, again, represent the successful exploration and development of ideas resulting in something known that was unknown before you started.