How add a custom posttype name using ACF field to a query post array

Firstly, don’t use query_posts()

It should be noted that using this to replace the main query on a page
can increase page loading times, in worst case scenarios more than
doubling the amount of work needed or more. While easy to use, the
function is also prone to confusion and problems later on. See the
note further below on caveats for details.

https://developer.wordpress.org/reference/functions/query_posts/#more-information

Secondly, it really sounds like you’re taking the wrong approach here. When you say:

so I can generate more pages using 1 templates for different
posttypes.

Do you realise WordPress automatically creates pages for post type and taxonomy archives? You just need to have the post type and taxonomy be public. WordPress will pick the appropriate template for these pages based on the Template Hierarchy.

But regarding using ACF fields in query arguments (whether in query_posts() or WP_Query), the issue is two things:

  1. You need to use a function that returns a value, rather than outputting it to the screen. See the answers to this Stack Overflow question for more information on the difference.
  2. You’re trying to use a function inside a string (text between quotes '').

Since Advanced Custom Fields’ function for returning a field value is get_field(), you would use it like this:

'taxonomy' => get_field( 'posttype_name' ),

Pay close attention to where ', ;, and , are used, compared to your attempt.