How to retrieve application

I am trying to implement a solution which provide me list of rules created for M2M application. Any document to implement that solution.

Not sure if this what you mean, but you can get a list of all Rules from the Management API:

However, Rules apply globally to all applications in the tenant. If you want them to be executed only for certain application, you would filter this via if/else base on the clientID of the application within the rule itself.

Lets say I have created rules specific for any application by context.clientname==App Name in the first few line of code itself. I want dynamic solution which filters the list of rule for any particular application.

Is there any way I get list of applications and name of rules created for that particular application ?

Yes, list of rules via Management API, see link in previous answer.

List of applications (clients) also via Management API, via this method:

If you’re using a certain naming convention for the Rules (i.e. putting the ClientID in the rule name, for which you use them), then it should be easy to filter them after you retrieved them all. The filtering needs to be done on your end, there’s no way to filter it directly from the Management API.