After activating my plugin i should go to settings -> permalinks and click on save button to make custom endpoints ( for my-account page ) work. How can i do it programmatically? ( I used flush_rewrite_rules but it didn't work. )
flush_rewrite_rules should only be called on the plugin activation OR after you update or add rewrite rules programatically.
If it does not work after verifying this, there is some other issue on your site. Make sure you are not calling
flush_rewrite_rules in constructor or somewhere else on every page load.