I want to know if the following reasoning is correct for this problem:
We assign the random variable $X_i$ which takes value $1$ if $HHT$ pattern starts at index $i$ in the sequence of outcomes, and $0$ otherwise.
So, $E(X_i) = \frac 1{8}$
Let $X$ be total expected number.
Then by linearity of expectation, we will get $E(X) = \frac {n-2}8$
Yes, that's correct. The $X_i$ are not independent, but for expectation that doesn't matter.
(edited to discuss a question in the comments) If you want the expected number of tosses until you get a HHT, you can do that as follows. Let this number be $x$; it's easy to see that $x<\infty$.
If the first toss is T, you have used up a toss and have to start again. So the conditional expected number given the first toss is T is $1+x$. Similarly, conditional on starting HT the expected number is $2+x$. The only remaining possibility is a start of HH - now the next tail will complete a HHT, and the expected number of tosses is $4$ ($2$ you've already done, plus $2$ on average to get a tail). So $$x=\frac12(1+x)+\frac14(2+x)+\frac14(4),$$ and solving this gives $x=8$.