Hey Disha,
I think you are worried about how to generate(add) dynamic columns. I'm attaching a small piece of code that will serve your purpose. Download it and upload in your system. Trace and learn it.
.
Another way is to have an ITAB with maximum possible columns. And adjust add them in the field_catlog as per your requirement(logic). Though it looks difficult in the beginning But not much hard once you get the grip of it.
.
Regards,
N.G.