you make mistake in writing it, the original is correct. remember such grammar rule as :
If the adverb "only" produce or introduce an adverbial clause, the main verb should be in inversion.
For example,
Only in this way can you learn English well = You can learn English well only in this way.
pay careful attention to : The "you can learn" is changed into → "can you learn". If there is not a modal verb "can" , you will use the "do" to replace it .
→
Only in this way do you learn English well = You learn English well only in this way.