Hi Tapasya,
I am not very sure whether we have a BAPI for collecting this information.
But there are other way around to achieve this
1) Execute tcode SUIM >>Users >> Select "By Logon date and password change" and execute>> enter the required input field (No.days since last logon = "90") and execute again - you will get the required details here
or
2) Directly execute report RSUSR200 in SE38 which will take you directly to "List of users according to logon date and password change " screen , enter the input values here(No.days since last logon = "90") and execute again to get the desired output.
I hope it helps you
Best Regards,
Mervin Joseph