What do you get as result, when doing following console-log?
console.log("link to dynamic page is = ", linkToDynamicPage);
console.log(typeOf linkToDynamicPage);
Surely not a ----> STRING, right?
And this is why you get the message:
Wix code SDK error: The url parameter that is passed to the to method cannot be set to the value /edit-product-detail/13834514. It must be of type string.
Because your defined —> linkToDynamicPage is not a STRING!
You have to convert it first to a STRING, to make it work.
Perhaps this one…
let linkToDynamicPage = [("/edit-product-detail/"+title).toString()]