Hi Nischal
There might be better answers out there (or there might not!). But in Moodle 3.5 and also available in versions 3.3 and 3.4 , a user can make a request for their data. The admin approves it and the user can then download it.
https://docs.moodle.org/35/en/Data_privacy
The user's data actually comes in JSON format with files in a zip. I am pretty sure someone will come up with a viewer soon enough. There was a bit of a rush to get the basic functionality done in time for GDPR.
The other option is to use a Moodle portfolio plugin. There are some core ones, as well as contributed ones. These allow the student to export their forum post or assignment submission, to a portfolio. This "portfolio" could be an external system, Google Drive , a blog, or just a file even.
https://docs.moodle.org/35/en/Portfolios