Sorry to say that I think you have just found out why the last owner got rid of it. Take it to a garage to have the problem properly diagnosed.
It's going into limp mode. Google that and the make/model
Change the fuel filter/s, and check air filter. (Hold up to sunlight, if you can see light thru it, it's OK)
it may be the turbo boost pipe,if it is a turbo that is
If i turn car off then back on i get the power back until i give it a bit again, its like i loose the turbo, there is no black smoke comeing out, but it really struggles gaining any real speed but the car is still driving, i have only just brought car and dont know alot about them, i am going out of my mind here.