I want to create apps which will works both in SharePoint Online & On Premises versions. So can you please help me how I can start and what will be the way to do so.
SPFx is a novel approach on client-side development that works in SharePoint Online and on premises as well. SharePoint 2016 supports an older version of SPFx than SharePoint Online: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/sharepoint-2016-support
Is this approach possible for you? What exactly do you want to achieve?