I am confused between
I don't know how can I do this
I don't know how I can do this
Can anyone explain difference between these sentences?
"I don't know how I can do this" is correct.
The emboldened expression is a subordinate interrogative clause: it is a clause that's embedded in the main clause and serves as a complement of the verb "know".
The subordinate interrogative differs from the main interrogative in that it does not allow the subject-auxiliary inversion to occur (Huddleston & Pullum, 2002: p. 972):
The main structural difference between subordinate and main clause interrogatives is the subject-auxiliary inversion does not generally apply in the subordinate construction:
i. Has he read it?
ii. What did he do?
i. I wonder [whether/if he has read it].
ii. I know [what he did].
It's possible, however, to the use the 'inverted' version when the clause is not fully attached to the main clause, in which case, it may be separated by a punctuation mark such as the colon or the em-dash.
The subject-auxiliary inversion is not wholly excluded from the subordinate interrogatives, but it's largely restricted (in Standard English) to constructions where questions are cited, as in Easily the most popular question put to the PM was: Why are we buying the New Zealand carpets for the new Parliament House? (p. 973)