Styling only the newest line of output in div

Depending on the container your divs are in, you can use CSS last:child (https://developer.mozilla.org/en-US/docs/Web/CSS/:last-child) like this:

So if your container has the class display, you'd do

.display div:last-child {
    display: flex; 
    justify-content: flex-end;
    background-color:aquamarine    
}

In case you don't know how to use this outside of javascript, simply wrap the above code in a style tag and add it to the head of your html document.

For clarity and possibly-upcoming-changes reasons, i highly suggest giving all of your divs a class on creation and using that instead of just div in the CSS. It's just easier to maintain that way.

.message-wrapper .message:last-child {
  color: red;
}
<div class="message-wrapper">
  <div class="message">Message 1</div>
  <div class="message">Message 2</div>
  <div class="message">Message 3</div>
</div>