In your above post, you have some templating. But, unfortunately, templating is not supported in the Custom HTML Block.
From what it seems like, the feature you’re describing would be a better fit as an Experience Page.
Here is a great walkthrough to get you up to speed: https://docs.losant.com/experiences/walkthrough/views/overview/
Also, there is a full course on Experiences in Losant University.