what should I do to make that output possible
Look at the output line by line and find the relationship between what is printed on a line, which line it is and the number of lines to be printed. When you find the relationship, then write pseudo code for an algorithm and then write the program code from that algorithm.
You know the last line has a single 1 (1 number)
and the next to the last line has 23 (2 numbers)
Continue with the rest of the lines. How many numbers for how many lines? If 2 lines then 3 numbers.