Step 1: Put the equation in linear form
\[
x\frac{dy}{dx}=y+x^2\cot x
\;\Rightarrow\;
\frac{dy}{dx}-\frac{1}{x}y=x\cot x
\]
This is a linear first-order differential equation.
Step 2: Find the integrating factor
\[
\text{I.F.}=e^{\int -\frac{1}{x}\,dx}=\frac{1}{x}
\]
Step 3: Multiply throughout by the integrating factor
\[
\frac{1}{x}\frac{dy}{dx}-\frac{1}{x^2}y=\cot x
\]
\[
\Rightarrow \frac{d}{dx}\!\left(\frac{y}{x}\right)=\cot x
\]
Step 4: Integrate
\[
\frac{y}{x}=\int \cot x\,dx=\ln(\sin x)+C
\]
\[
y=x\bigl(\ln(\sin x)+C\bigr)
\]
Step 5: Use the given condition
\[
y\!\left(\frac{\pi}{2}\right)=\frac{\pi}{2}
\]
\[
\frac{\pi}{2}=\frac{\pi}{2}\bigl(\ln 1 + C\bigr)
\Rightarrow C=1
\]
\[
\boxed{y=x\bigl(\ln(\sin x)+1\bigr)}
\]
Step 6: Evaluate required expression
\[
y\!\left(\frac{\pi}{6}\right)
=\frac{\pi}{6}\!\left(\ln\frac12+1\right)
=\frac{\pi}{6}(1-\ln2)
\]
\[
y\!\left(\frac{\pi}{4}\right)
=\frac{\pi}{4}\!\left(\ln\frac{\sqrt2}{2}+1\right)
=\frac{\pi}{4}\!\left(1-\frac12\ln2\right)
\]
\[
6y\!\left(\frac{\pi}{6}\right)-8y\!\left(\frac{\pi}{4}\right)
= \pi(1-\ln2)-2\pi\!\left(1-\frac12\ln2\right)
\]
\[
= \pi-\pi\ln2-2\pi+\pi\ln2
= -\pi
\]
\[
\boxed{-\pi}
\]