How to send AT command to sim800l and read result?

I have sim800l module connected to arduino and i’m trying to initialize it in my setup function with this code:

#include <SoftwareSerial.h>

//SIM800 TX is connected to Arduino D8
#define SIM800_TX_PIN 6
//SIM800 RX is connected to Arduino D7
#define SIM800_RX_PIN 7
SoftwareSerial serialSIM800(SIM800_TX_PIN,SIM800_RX_PIN);

void setup()
{
Serial.begin(38400);
while(!Serial);
serialSIM800.begin(38400);
Serial.println(“wait for … it”);
delay(10000);

// comments added just for example, both commands return junk
//serialSIM800.write(“AT\r\n”);
//serialSIM800.write(“AT+SAPBR=3,1,“Contype”,“GPRS”\r\n”);

Serial.println(“command sent”);
delay(2500);

Serial.write(serialSIM800.read());
}

but Serial.write return’s junk.

When i use this code

//Read SIM800 output (if available) and print it in Arduino IDE Serial Monitor
if(serialSIM800.available()){
Serial.write(serialSIM800.read());
}
//Read Arduino IDE Serial Monitor inputs (if available) and send them to SIM800
if(Serial.available()){
serialSIM800.write(Serial.read());
}

and send AT+SAPBR=3,1,"Contype","GPRS" or just AT command with serial monitor, everything works fine.

Can someone help with this?