You don't need the foreach loop as you have for @lines.
my $SCU = 'C:/Users/Desktop/a.txt';
open (FILE, '<', $SCU) or die "$SCU File not found : $!";
my @lines = <FILE>;
push @newlines, s/test/xyz/rg for @lines;
open (FILE, '>', $SCU) or die "Could not open file $SCU: $!";
print FILE @newlines;