Your code does not evaluate, because you do not provide the starting values of Ha etc. I am not sure what you want, but perhaps you could try a Manipulate
:
hdPts[Ha_, Da_, Gmax_, pK1_, pK2_, displaypoints_] :=
Module[{HD, HG, H, G, D},
HDpoints = {}; HGpoints = {}; Hpoints = {}; Gpoints = {};
Dpoints = {};
Quiet[Flatten[
Flatten[Delete[
Do[{solut =
N[NSolve[{10^pK1 == HD/(H*D), 10^pK2 == HG/(H*G),
Ha == HD + HG + H, Ga == HG + G, Da == HD + D}, {HD, HG,
H, G, D}], 30], HDfirst = HD /. Part[solut, 1, 4],
HDsecond = HD /. Part[solut, 2, 4],
HDthird = HD /. Part[solut, 3, 4],
HGfirst = HG /. Part[solut, 1, 5],
HGsecond = HG /. Part[solut, 2, 5],
HGthird = HG /. Part[solut, 3, 5],
Hfirst = H /. Part[solut, 1, 1],
Hsecond = H /. Part[solut, 2, 1],
Hthird = H /. Part[solut, 3, 1],
Gfirst = G /. Part[solut, 1, 2],
Gsecond = G /. Part[solut, 2, 2],
Gthird = G /. Part[solut, 3, 2],
Dfirst = D /. Part[solut, 1, 3],
Dsecond = D /. Part[solut, 2, 3],
Dthird = D /. Part[solut, 3, 3],
If[
0 <= HDfirst <= Da && 0 <= HGfirst <= Ga &&
0 <= Dfirst <= Da && 0 <= Gfirst <= Ga &&
0 <= Hfirst <= Ha && HGfirst <= Ha && HDfirst <= Ha &&
Hfirst + HGfirst + HDfirst <= Ha &&
Gfirst + HGfirst <= Ga &&
Dfirst + HDfirst <= Da, {AppendTo[
HDpoints, {Ga, HDfirst/Ha}],
AppendTo[HGpoints, {Ga, HGfirst/Ha}],
AppendTo[Hpoints, {Ga, Hfirst/Ha}],
AppendTo[Dpoints, {Ga, Dfirst/Da}],
AppendTo[Gpoints, {Ga, Gfirst/Ga}]}],
If[
0 <= HDsecond <= Da && 0 <= HGsecond <= Ga &&
0 <= Dsecond <= Da && 0 <= Gsecond <= Ga &&
0 <= Hsecond <= Ha && HGsecond <= Ha && HDsecond <= Ha &&
Hsecond + HGsecond + HDsecond <= Ha &&
Gsecond + HGsecond <= Ga &&
Dsecond + HDsecond <= Da, {AppendTo[
HDpoints, {Ga, HDsecond/Ha}],
AppendTo[HGpoints, {Ga, HGsecond/Ha}],
AppendTo[Hpoints, {Ga, Hsecond/Ha}],
AppendTo[Dpoints, {Ga, Dsecond/Da}],
AppendTo[Gpoints, {Ga, Gsecond/Ga}]}],
If[
0 <= HDthird <= Da && 0 <= HGthird <= Ga &&
0 <= Dthird <= Da && 0 <= Gthird <= Ga &&
0 <= Hthird <= Ha && HGthird <= Ha && HDthird <= Ha &&
Hthird + HGthird + HDthird <= Ha &&
Gthird + HGthird <= Ga &&
Dthird + HDthird <= Da, {AppendTo[
HDpoints, {Ga, HDthird/Ha}],
AppendTo[HGpoints, {Ga, HGthird/Ha}],
AppendTo[Hpoints, {Ga, Hthird/Ha}],
AppendTo[Dpoints, {Ga, Dthird/Da}],
AppendTo[Gpoints, {Ga, Gthird/Ga}]}]}, {Ga, 0.00000001,
Gmax, Gmax/displaypoints}], 1], 1], 1]]];
Manipulate[
ListLinePlot[hdPts[Ha, Da, Gmax, pK1, pK2, displaypoints],
PlotRange -> {0, 1}],
{Ha, 0, 1},
{Da, 0, 1},
{Gmax, 0, 1},
{pK1, 0, 1},
{pK2, 0, 1},
{{displaypoints, 100}, 1, 200}]
As it is, it does not work, perhaps because of bad initial values. It may not be a good idea to use capital letters as variables, specially one like D, which has its own meaning.