Recording then playing back RS232 data

Sorry I have looked but couldn't really find the answer to this.

Could I simply record the data coming from an RS232 source then simply play that same data back. I know there is a level change in signal voltage but what else would I require to achieve it.

I am a novice at this I'm afraid so please make it simple thank you.

Yes; use a level converter (e.g. MAX232).

Just be aware of the memory limitations of the different Arduinos. E.g. a 328P based board has only 2K so recording is limited (possibly around 1000 bytes).

Would an ESP32 be better I believe they have more ram.
Also a few pointers into how could you give me an idea on how to create a simple program to achieve this.
All I want to do is to connect it up to the machine record a button being pressed then simply replay that same data back on another machine.
I know how to send and receive data one at a time but not how to record a half a second of 38400 bits a second in a stream of information I have no idea how to do that.

Below code should give you an idea. Two buttons, one to start recording and one to start playback. Buttons wired between pin and GND (so when a button is pressed it will be read as LOW). The builtin led is used to indicate when a 'recording is complete'.

const byte recordPin = 2;
const byte playbackPin = 3;

byte data[1000];

void setup()
{
  Serial.begin(38400);
  pinMode(recordPin, INPUT_PULLUP);
  pinMode(playbackPin, INPUT_PULLUP);
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);
}

void loop()
{
  // flag indicating recording is in progress
  static bool recordInProgress = false;
  // variable to hold number of recorded bytes
  static uint32_t numBytes;

  if (digitalRead(recordPin) == LOW)
  {
    // start filling array from first position
    numBytes = 0;
    // indicate recording in progress
    recordInProgress = true;
    // switch led off if recording is in progress
    digitalWrite(LED_BUILTIN, LOW);
  }

  if (recordInProgress == true)
  {
    if (Serial.available() > 0)
    {
      data[numBytes++] = Serial.read();
      if (numBytes == sizeof(data))
      {
        // stop recording when buffer (data) is full
        recordInProgress = false;
        // indicate that recording is complete
        digitalWrite(LED_BUILTIN, HIGH);
      }
    }
  }

  // if buffer full
  if (numBytes == sizeof(data))
  {
    if (digitalRead(playbackPin) == LOW)
    {
      // play back the data
      for (uint32_t cnt = 0; cnt < sizeof(data); cnt++)
      {
        Serial.write(data[cnt]);
      }
    }
  }
}

Notes
1)
The playback will be as fast as the Arduino can pump out the data. The code does not record the time between received bytes, so playback has no idea about the timing of the incoming bytes.
2)
You can only play back once the buffer is full; it's just example code.