How to use variable in a jekyll liquid loop?

Using Liquid, you think about what you need first, which in your case is post.title. That title lives in site.posts, so you start by creating an array of posts. When creating the array, you add a filter to inform Jekyll what content you are looking for by using a where or where_exp filter.

Here is what your final code might look like:

{%- assign posts = site.posts | where_exp: 'post', 'post.category == tech' -%}
{% for post in posts %}
    <p>Title = {{post.title}}
{% endfor %}