DSolve[{z'[x] == 1+x, z[0]==1}, z[x], x]
But it is not clear what you mean by "you need to find $f(x, n).$" You mean, a closed form for any $n$? Or?
In any case, to get it for any fixed $n,$ you can use:
ds[foo_] := (z[x] /. DSolve[{z'[x] == foo, z[0] == 1}, z[x], x])[[1]]
Nest[ds, 1+x, n]
For example:
Nest[ds, 1 + x, 50]
Gives you:
$$
\frac{x^{51}+51 x^{50}+2550 x^{49}+124950 x^{48}+5997600 x^{47}+281887200
x^{46}+12966811200 x^{45}+583506504000 x^{44}+25674286176000 x^{43}+1103994305568000
x^{42}+46367760833856000 x^{41}+1901078194188096000 x^{40}+76043127767523840000
x^{39}+2965681982933429760000 x^{38}+112695915351470330880000
x^{37}+4169748868004402242560000 x^{36}+150110959248158480732160000
x^{35}+5253883573685546825625600000 x^{34}+178632041505308592071270400000
x^{33}+5894857369675183538351923200000 x^{32}+188635435829605873227261542400000
x^{31}+5847698510717782070045107814400000 x^{30}+175430955321533462101353234432000000
x^{29}+5087497704324470400939243798528000000
x^{28}+142449935721085171226298826358784000000
x^{27}+3846148264469299623110068311687168000000
x^{26}+99999854876201790200861776103866368000000
x^{25}+2499996371905044755021544402596659200000000
x^{24}+59999912925721074120517065662319820800000000
x^{23}+1379997997291584704771892510233355878400000000
x^{22}+30359955940414863504981635225133829324800000000
x^{21}+637559074748712133604614339727810415820800000000
x^{20}+12751181494974242672092286794556208316416000000000
x^{19}+242272448404510610769753449096567958011904000000000
x^{18}+4360904071281190993855562083738223244214272000000000
x^{17}+74135369211780246895544555423549795151642624000000000
x^{16}+1186165907388483950328712886776796722426281984000000000
x^{15}+17792488610827259254930693301651950836394229760000000000
x^{14}+249094840551581629569029706223127311709519216640000000000
x^{13}+3238232927170561184397386180900655052223749816320000000000
x^{12}+38858795126046734212768634170807860626684997795840000000000
x^{11}+427446746386514076340454975878886466893534975754240000000000
x^{10}+4274467463865140763404549758788864668935349757542400000000000
x^9+38470207174786266870640947829099782020418147817881600000000000
x^8+307761657398290134965127582632798256163345182543052800000000000
x^7+2154331601788030944755893078429587793143416277801369600000000000
x^6+12925989610728185668535358470577526758860497666808217600000000000
x^5+64629948053640928342676792352887633794302488334041088000000000000
x^4+258519792214563713370707169411550535177209953336164352000000000000
x^3+775559376643691140112121508234651605531629860008493056000000000000
x^2+1551118753287382280224243016469303211063259720016986112000000000000
x+1551118753287382280224243016469303211063259720016986112000000000000}{155111875328738
2280224243016469303211063259720016986112000000000000}
$$