Problems with sitemap.xml

I have my WP instalation on domain
and my frontity instalation on domain

I need that on url i will get sitemap file
and dont understand how to do that, i already read that top

but dont understand where is @frontity/sitemap package
and where i must put that code

export const server = ({ app }) => {
    get("/sitemap-*.xml", async ctx => {
      const origin = ctx.settings.state.sitemap.orign;
      const frontityUrl = ctx.settings.state.frontity.url;
      // Get the original sitemap from the WordPress site.
      const response = await fetch(`${origin}/${ctx.path}`);
      const body = await response.text();
      // Replace the URLs of WordPress for URLs of Frontity.
      ctx.body = body.replaceAll(origin, frontityUrl);
      // Do not cache this.
      ctx.set("cache-control: no-cache");

Please explain me this method or help to find another

Hi, @shevabogdan16 this below post can help you a lot.