While KM does not directly provide a simple solution, this is easily done in JXA, using a Execute a JavaScript For Automation action.
Assuming your source text is in a KM Variable "Local__SourceStr", this script will do the job:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Example Output

MACRO: Reverse Lines [Example]
~~~ VER: 1.0 2019-09-25 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
DOWNLOAD Macro File:
Reverse Lines [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
JXA Script
(function myMain() { // ~~~ automatically executed when this script is executed ~~~
var ptyScriptName = "Reverse Lines in String"
var ptyScriptVer = "1.0"
var ptyScriptDate = "2019-09-25"
var ptyScriptAuthor = "JMichaelTX"
// --- SET CURRENT APP VARIABLE NEEDED FOR DIALOGS & StandardAdditions.osax ---
var app = Application.currentApplication()
app.includeStandardAdditions = true
// --- KM ENGINE APP ---
var kmInst = app.systemAttribute("KMINSTANCE"); // needed for Local & Instance variables
var kmeApp = Application("Keyboard Maestro Engine")
var sourceStr = kmeApp.getvariable("Local__SourceStr", {instance: kmInst});
if (!sourceStr) {throw new Error('Source string MUST contain at least one line'); }
var sourceList = sourceStr.split('\n');
var revList = sourceList.reverse();
return revList.join('\n');
})(); // ~~~ function myMain() is automatically executed when this script is executed ~~~