Esp8266 board not working

Hello
I got an esp8266 board, after burning the code to the board, it refuses to print out on the serial monitor
The code I used was the led blinking example which the led blinks and it outputs to the serial monitor..the led blinks till I open up the serial monitor and it stops blinking till I close the serial monitor

#include <Arduino.h>

#define LED 2

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(LED, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(LED, HIGH);
  Serial.println("LED is on");
  delay(1000);
  digitalWrite(LED, LOW);
  Serial.println("LED is off");
  delay(1000);
}

What code?

#include <Arduino.h>

#define LED 2

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(LED, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(LED, HIGH);
  Serial.println("LED is on");
  delay(1000);
  digitalWrite(LED, LOW);
  Serial.println("LED is off");
  delay(1000);
}

Is there a built-in LED on pin 2?

Yes
It blinks well when the code is running, but when I try to open the serial monitor it stops and only continues when I close it

Try disabling the LED code and seeing if the serial monitor works without the LED code.
the pin mode and both digital writes

I tried the board with an ultrasonic sensor (HCSRO4) to print the distance between the sensor and object it didn't print out anything

Let's work on one thing at a time though

Oh I'm not getting you

See comment 6

It's not still printing

Did you set the correct baud rate on the serial monitor?

Yes 115200

#include <Arduino.h>

That's not the same rate that's in your code

I used the 9600 too
Used 115200
Same thing

I should remove the line?

@mozman777
Affirmative

Still not working
The board is blinking but not printing

Both NL & CR