custom function to create a quote

custom function to create a quote

I am creating a Quote through custom function , but when I add the data "Product Details" in the query I am getting an error . Any solution ?