Clear[f,x,n]
NodeVals = {0.0,0.1,0.5,0.7,0.8,1.0};
NodeVals=Range[0,1,0.1];
n = Length[NodeVals];
f[x_]:=Sin[x]
K= SparseArray[{},{n,n}];
KTemp=K;

Here is a general tent function!

ϕ[x_,{xMinus_,xMid_,xPlus_}] := Which[
xMinus<x<xMid, (x-xMinus)(1/(xMid-xMinus)),
xMid<x<xPlus,(x-xPlus) (1/(xMid-xPlus)),
True, 0
]
ϕx[x_,{xMinus_,xMid_,xPlus_}] := Which[
xMinus<x<xMid, (1/(xMid-xMinus)),
xMid<x<xPlus, (1/(xMid-xPlus)),
True, 0
]
{xMinus,xMid,xPlus}={0.1, 0.5, 0.8};
Plot[{ϕ[x,{xMinus,xMid,xPlus}],ϕx[x,{xMinus,xMid,xPlus}]},
{x,0,1},
PlotRange->All]

LoadVector=Table[
NIntegrate[ ϕ[x, {NodeVals[[i-1]], NodeVals[[i]], NodeVals[[i+1]]}] f[x],{x,0,1}],
{i, 2, n-1}]

StiffnesMatrix= Table[
NIntegrate[
ϕx[x,{NodeVals[[i-1]], NodeVals[[i]], NodeVals[[i+1]]}]*ϕx[x,{NodeVals[[j-1]], NodeVals[[j]], NodeVals[[j+1]]}],
{x,0,1}],
{i,2, n-1},
{j, 2, n-1}
]

U =LinearSolve[StiffnesMatrix,LoadVector];
UTemp=Join[{0},U,{0}]
ListPlot[Transpose[{NodeVals,UTemp}],
Joined->True,
Mesh->All]