how can i remove turn editing on/off from gear menu
What version of Moodle are you using? In Moodle 3.9 and later, turn editing on is a button and is no longer in the Actions menu.
In a course in the upper corner of right side there is a gear menu in this menu there are multiple options available one is turn editing on or off so my requirement is to hide this particular option from this gear menu dropdown list through programming or through interface.
I think in the lib folder a file named navigationlib.php has the settings for this. there is a function front_page_setting in this function a if condition present for this.
Why? If you don't want people to have the right to edit then don't give them the "Teacher" role in the first place (Non-editing teacher perhaps?)