Translation and rotation I have some problems

So what I have is a tunnel made of wall segments and here all I am trying to do is assemble them so that they fit geometrically. The base of the tunnel works OK but the sides i can’t seem to get them right for some reason. This is my code

mesh[0].loadOBJ("models/plane.obj");
	mesh[1].loadOBJ("models/plane.obj");
	mesh[2].loadOBJ("models/plane.obj");
	mesh[3].loadOBJ("models/plane.obj");
	mesh[4].loadOBJ("models/lightceiling1.obj");
	mesh[5].loadOBJ("models/lightCeiling.obj");
	//mesh[6].loadOBJ("models/key.obj");

	texture[0].loadTexture("textures/awall0.png", true, true);
	texture[1].loadTexture("textures/floorTile1.png", true, true);
	texture[2].loadTexture("textures/awall0.png", true, true);
	
	texture[3].loadTexture("textures/ceiling.png", true, true);
	texture[4].loadTexture("textures/ceilcols.png", true, true);
	texture[5].loadTexture("textures/ceilcols.png", true, true);
	
	// Model positions
	glm::vec3 modelPos[] = {
		glm::vec3(-1.0f, 0.0f, 2.0f),
		glm::vec3(0.0f, -1.0f, 2.0f),
		glm::vec3(1.0f, 0.0f, 2.0),
		
		
		
		glm::vec3(0.0f, 1.0f, 2.0f),
		glm::vec3(0.0f, 1.0f, 2.0f),	
		glm::vec3(0.0f, 1.0f, 2.0f),
		
	};
	/*
	glm::vec3 modelRots[] = {
		glm::vec3(glm::radians(90), 0, 0),
		glm::vec3(glm::radians(270), 0, 0),
		glm::vec3(0, 0, 0),
		glm::vec3(glm::radians(180), 0, 0)
	};
	*/
	float therot[] = { 90.0f, 0.0f, 270, 180.0f };
	// Model scale
	glm::vec3 scale(1, 1, 1);


	double lastTime = glfwGetTime();
	float angle = 0.0f;

	getWalls(0, 0, 0);
	// Rendering loop
	while (!glfwWindowShouldClose(gWindow))
	{
		showFPS(gWindow);

		double currentTime = glfwGetTime();
		double deltaTime = currentTime - lastTime;

		// Poll for and process events
		glfwPollEvents();
		update(deltaTime);

		// Clear the screen
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		glm::mat4 model(1.0), view(1.0), projection(1.0);

		// Create the View matrix
		view = fpsCamera.getViewMatrix();

		// Create the projection matrix
		projection = glm::perspective(glm::radians(fpsCamera.getFOV()), (float)gWindowWidth / (float)gWindowHeight, 0.1f, 200.0f);

		// Must be called BEFORE setting uniforms because setting uniforms is done on the currently active shader program.
		lightingShader.use();

		// Directional light
		lightingShader.setUniform("view", view);
		lightingShader.setUniform("projection", projection);
		lightingShader.setUniform("viewPos", fpsCamera.getPosition());
		lightingShader.setUniform("dirLight.direction", glm::vec3(0.0f, -0.9f, -0.17f));
		lightingShader.setUniform("dirLight.ambient", glm::vec3(0.2f, 0.2f, 0.2f));
		lightingShader.setUniform("dirLight.diffuse", glm::vec3(1.0f, 1.0f, 1.0f));
		lightingShader.setUniform("dirLight.specular", glm::vec3(1.0f, 1.0f, 1.0f));
		for (int j = 0;j < 20;j++) {
			glm::vec3 updpos = glm::vec3(0, 0, 2 * j);
			bool isrnd = false;
			for (int i = 0; i < 3; i++)
			{
				if (iswall[i][j] ) {
					float sumrot;
					sumrot = therot[i];
					model = glm::mat4(1.0f);

					model = glm::translate(glm::mat4(1.0), modelPos[i] - updpos) * glm::scale(glm::mat4(1.0), scale) * glm::rotate(model, glm::radians(therot[i]), glm::vec3(0, 0, 1));

					lightingShader.setUniform("model", model);

					// Set material properties
					lightingShader.setUniform("material.ambient", glm::vec3(0.1f, 0.1f, 0.1f));
					lightingShader.setUniformSampler("material.diffuseMap", 0);
					lightingShader.setUniform("material.specular", glm::vec3(0.8f, 0.8f, 0.8f));
					lightingShader.setUniform("material.shininess", 32.0f);

					texture[i].bind(0);		// set the texture before drawing.
					mesh[i].draw();			// Render the OBJ mesh
					texture[i].unbind(0);
				}
				else {
					
					if (i == 0 || i == 2) {
						isrnd = true;
					
						if (i == 0) {
							glm::vec3 distPos[] = {
							glm::vec3(-2.0f, 0.0f, 1.0f),
							glm::vec3(-2.0f, 0.0f, 0.0f),
							glm::vec3(-2.0f, 0.0f, -1.0),



							glm::vec3(0.0f, 1.0f, 0.0f),
							glm::vec3(0.0f, 1.0f, 0.0f),
							glm::vec3(0.0f, 1.0f, 0.0f),

							};
							float inrot[] = { 90, 0, 270 };
							for (int k = 0;k < 3;k++) {
								float sumrot;
								sumrot = therot[k];
								model = glm::mat4(1.0f);

								model = glm::translate(glm::mat4(1.0), modelPos[k] - updpos + distPos[k]); 
								model = glm::scale(glm::mat4(1.0), scale);
								model = glm::rotate(model, glm::radians(therot[k]), glm::vec3(0, 0, 1));
								model = glm::rotate(model, glm::radians(inrot[k]), glm::vec3(0, 1, 0));

								lightingShader.setUniform("model", model);

								// Set material properties
								lightingShader.setUniform("material.ambient", glm::vec3(0.1f, 0.1f, 0.1f));
								lightingShader.setUniformSampler("material.diffuseMap", 0);
								lightingShader.setUniform("material.specular", glm::vec3(0.8f, 0.8f, 0.8f));
								lightingShader.setUniform("material.shininess", 32.0f);

								texture[k].bind(0);		// set the texture before drawing.
								mesh[k].draw();			// Render the OBJ mesh
								texture[k].unbind(0);
							}
						}else{
							glm::vec3 distPos[] = {
							glm::vec3(2.0f, 0.0f, 1.0f),
							glm::vec3(2.0f, 0.0f, 0.0f),
							glm::vec3(2.0f, 0.0f, -1.0),



							glm::vec3(0.0f, 1.0f, 2.0f),
							glm::vec3(0.0f, 1.0f, 2.0f),
							glm::vec3(0.0f, 1.0f, 2.0f),

							};

							float inrot[] = { 90, 0, 270 };
							
							for (int k = 0;k < 3;k++) {
								float sumrot;
								sumrot = therot[k];
								model = glm::mat4(1.0f);

								model = glm::translate(glm::mat4(1.0), modelPos[k] - updpos + distPos[k]);
								model = glm::scale(glm::mat4(1.0), scale); 
								model = glm::rotate(model, glm::radians(therot[k]), glm::vec3(0, 0, 1));
								model = glm::rotate(model, glm::radians(inrot[k]), glm::vec3(0, 1, 0));
								lightingShader.setUniform("model", model);

								// Set material properties
								lightingShader.setUniform("material.ambient", glm::vec3(0.1f, 0.1f, 0.1f));
								lightingShader.setUniformSampler("material.diffuseMap", 0);
								lightingShader.setUniform("material.specular", glm::vec3(0.8f, 0.8f, 0.8f));
								lightingShader.setUniform("material.shininess", 32.0f);

								texture[k].bind(0);		// set the texture before drawing.
								mesh[k].draw();			// Render the OBJ mesh
								texture[k].unbind(0);
							}
						

						}
					}
					else {

					}
				}
					
				
			}
			float sumrot;
			int ceiltype = 5;
			if (isrnd) ceiltype = 4;
			sumrot = therot[3];
			model = glm::mat4(1.0f);

			model = glm::translate(glm::mat4(1.0), modelPos[ceiltype] - updpos) * glm::scale(glm::mat4(1.0), scale) * glm::rotate(model, glm::radians(therot[3]), glm::vec3(0, 0, 1));

			lightingShader.setUniform("model", model);

			// Set material properties
			lightingShader.setUniform("material.ambient", glm::vec3(0.1f, 0.1f, 0.1f));
			lightingShader.setUniformSampler("material.diffuseMap", 0);
			lightingShader.setUniform("material.specular", glm::vec3(0.8f, 0.8f, 0.8f));
			lightingShader.setUniform("material.shininess", 32.0f);
			texture[5].bind(0);		// set the texture before drawing.
			mesh[ceiltype].draw();			// Render the OBJ mesh
			texture[5].unbind(0);
		}

My problem might be that I am applying a rotation to another rotation can this be done?