I found the solution myself.
I've tried to solve the problem by using divide and conquer. My solution has two parameters, start and step. Start is the value that is printed at the first step. and step is the value that shows the number of fractions.
If step = 1, then I print just the value of start. Otherwise for each step the numerator of the fraction is 2start and for denominator the value is 2start+1.
Here is the code of my solution.
def generate_fraction(start : int, step : int):
result = ""
if step == 1:
result = str(start)
else:
result = str(start) + '+\\frac{'+ generate_fraction(2*start, step-1) + '}{' + generate_fraction(2*start + 1, step-1) + '}'
return result
# Main Program ...
step = int(input())
start = 1
print(generate_fraction(start, step))