Problem finding Demand Function
You cannot empirically calculate the demand function in your current setting. Finding a demand function is indeed very difficult in general. 

What we can observe, i.e. the data you have, is the market equilibrium over time, i.e. the equilibrium price and quantity levels. These are determined by the interplay of supply and demand. So when you observe a price and quantity you are not observing demand, but rather a combination of demand and supply. 

To find the demand curve, you would need, for example, an instrument variable, i.e a variable that is correlated with demand, but independent of supply.