Designing a turing machine based on a starting and ending point

Hello i am a self taught software developer i am trying to learn turing machine in depth , i came to a problem which i can not solve , can you please help me with the design of the turing machine, any hints or thoughts would be super helpful.

I am attaching an image because this question can not be outwritten with math symbols.turing machine question

X , W a standing for word over an alphabet * stands for empty shelf Arrows are indicators whether should go to right or left