Errr, are you talking about this:
$variable = get_field('loop_category');
$args = array(
'category_name' => $variable,
);
$catquery = new WP_Query($args);
while ($catquery->have_posts()) {
$catquery->the_post();
// Do your thing
}
If so, this is basic PHP and has nothing to do with WordPress – even though this is used in its context.