It helps when you tell us what the error is and what line it occurs on

You are not doing anything with the return value of your function.

Code:
data2=prs(data2,"<td>","</td>")
Though i am not sure your function is doing the right thing, kind of hard to read it