What's complaining about incorrect configurations? The internal methods, or the result from the server? There are a lot of errors in that first script from non-existing variables to syntactical failures. The second looks like it's job is to generate the output but if it isn't including the first script after it than that is also useless. The third appears to be a resultant, but we haven't a clue how you get there or what it means. For that you need to consult the technical docs from the provider.
If you are getting a result in the third, that indicates a lot has been removed from the first before posting it here.