How can I get an offline access token for my custom app to store securely for further use?

To do it automatically, you could run the logic after authentication, something like:

app.get(
  shopify.config.auth.callbackPath,
  shopify.auth.callback(),
  installScriptTags(),
  shopify.redirectToShopifyOrAppRoot()
);