How do I convert an optical mouse into a line sensor for arduino?


You don't. If you want a line following bot try this.

https://www.instructables.com/id/PT-line-follower-Bot/#step1