In the markup add a literal control where you want the script:
<asp:TextBox ID="txtPublicProfileId" runat="server"></asp:TextBox>
<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
<asp:Literal ID="ltlMyScript" runat="server" Text='<script type="IN/MemberProfile" data-format="inline" data-id="" ></script>' ></asp:Literal>
And in code add the script with the id to the literal:
protected void Button1_Click(object sender, EventArgs e)
{
ltlMyScript.Text = "<script type=\"IN/MemberProfile\" data-format=\"inline\" data-id=\"" + txtPublicProfileId.Text + "\"></script>";
}
And here's how it is rendered with the id: