Well, it is an unorthodox way to do that task in python, but if you want to do it with the fewest line only with stantard libs, than you can use the inputfile
lib as follows:
$ cat test.txt
AL
DZ
AS
AO
AI
BS
BB
BY
BJ
BA
$ python3
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fileinput
>>> for line in fileinput.input("test.txt", inplace=True):
... print(line.replace(line, f"'{line.strip()}',"))
...
>>>
$ cat test.txt
'AL',
'DZ',
'AS',
'AO',
'AI',
'BS',
'BB',
'BY',
'BJ',
'BA',
$