Serial communication on Arduino Uno
Your code is not reading the SoftwareSerial. b is only populated when the Pi sent data. The loop below sends what it reads from the SoftwareSerial, after that is prints a new line println() (only because that's what your code is doing)

The listen() method of SoftwareSerial is only required if you have more than one SoftwareSerial connection.

#include &lt;SoftwareSerial.h&gt;

String b = "0";
SoftwareSerial portOne(2, 3); //RX= pin 2  TX= pin 3

void setup() {
  Serial.begin(9600, SERIAL_8N1); 
  portOne.begin(9600);
} 

void loop() {
  if (Serial.available() &gt; 0) {
    b = Serial.readString();
    Serial.println("Data from RPI:");
  }

 //not required with only one software serial connection
 //portOne.listen();

  if (portOne.available() &gt; 0)
  {
   while(portOne.available() &gt; 0){
      byte byteRead = portOne.read();
      Serial.write(byteRead);
    }
    Serial.println();
   }
  }