How to send bytes to CM1101 co2 sensor from arduino

I have to send 0x11, 0x01, 0x01, 0xED to the co2 sensor consequently then the co2 sensor will send me response data

To send the data
before setup loop I define
pattern =[0x11, 0x01, 0x01, 0xED];

then in the setup loop I write

no=0;
while(no<=3){
for(int i=0; i<8; i++){
boolean on_off=bitread(pattern[no], i);
digitalWrite(4, on_off);} no++;}

does this code transmit 0x11, 0x01, 0x01, 0xED in this order to the sensor?

does this code transmit 0x11, 0x01, 0x01, 0xED in this order to the sensor?

No

You can only output HIGH or LOW (1 or 0) using digitalWrite(). How is the sensor connected to the Arduino ? Please provide a link to the sensor that you are using.