Filebeat read different log paths and write to different elastic index with their own ilm policy,How?

Probably because of this same problem.

The setup.* configuration needs to be in the root of the configuration, not under the output.elasticsearch.

Also, if you already have the template in Elasticsearch you do not even need these configurations, you just need to have a template that matches your index in elasticsearch and you can remove the setup.template.* and setup.ilm.*.

Since you have two different indices and want to use different templates you cannot use those setup.template.* and setup.ilm.* configurations in filebeat, you need to manage everything in the template on elasticsearch.