The way to solve a larger problem is to break it down into smaller problems, and then solve each of them in-turn (possibly by again breaking...). In this case:
1/ read the file,
2/ prepare the data for analysis,
3/ analyse the data,
4/ report the results.
These represent a common data-science sequence.
1/ There are two methods for reading a file. Yes, it could be read line by line (as suggested elsewhere), but given that the quantity of data is small, why not use one command to read the entire file into a single string?
Take a look at this string. Apart from the letters, there are spaces, and one/a couple of other characters. NB These vary by operating system! It/they mark the ends of lines. (although you need to understand this concept)
Clarification: because of the question's wording ("lines"), I am assuming that if a line ends with a letter that is the same as the first letter on the successive line, such does NOT count!
2/ We need to "clean" the data by removing the spaces. Are you aware of the "null character" or "null string"/"nulstring"? There is a Python string function which enables the replacement of one string-character with another. Replace the spaces with 'nothing' and then we have "casaa..." and thus our first 'match'. There is no need to worry about the line-endings - they won't match any letters, or each-other (but these could also be removed, if desired).
3/ To analyse the data, please imagine doing it on-paper (or a whiteboard - a great code-design tool!). Write the characters in a column. Now, the problem appears to be comparing 'this character' with the one below it. However, this gives rise to the complication - what to do at 'the bottom' (where there is no 'next character')?
Instead, create a second column of characters to the right of the first BUT put the second input-character at the top of this second column, follow it with all the others, and add the 'first-character' at the bottom. ("and the first shall be last"!). Now, the problem can be visualised as checking 'across': is 'this' character in the left column the same as the corresponding character in the right column?
When it comes to doing this in Python, you could use two lists; but equally, you could elect to remain with strings (the input 'arrives' as a string, so is changing to a list of characters 'extra work'?)
Having two strings (or lists) to process, most find it necessary to make Python's for-loop work like some-other-language's for-loop. Don't do this: Python's is a "for each" loop designed to access each member of a collection in-turn, whereas others' for-loops are designed to provide "pointers" or "counters" which is a marsh/bog of opportunity for error.
However, the need here, is to process TWO collections (a string is a collection of characters!) at the same time. Python offers a function which allows us to zip two strings/lists/tuples/... together as if they were one entity - but organised pair-wise (cf "concatenation"). Sound familiar? This result (actually, a mechanism) can then passed to the for(each)-loop.
All you have to do (sounds so easy when someone else says it!) is to compare the 'left-character' with the 'right-character', and if they match, count them using a dictionary.
There's a(nother) problem here: the easiest way to 'count' is to use "+= 1", except that it assumes a zero-value the first time we count a letter. There are solutions, eg defaultdicts, but you might also review the dictionary function which gets a value if the dictionary-key (this letter) already exists, or returns a default value if it does not (when counting, zero).
In this way, you won't have a larger dictionary than necessary, full of zero-counts - which you would then have to remove/edit-out in the next step.
4/ Reporting the results is a matter of looping through the dictionary of counters and reporting the frequency of character-multiples.
Given that this is obviously a student-assignment, you won't learn if I give you the answer as code. However, the 'key words' (above) should be apparent - you could/should look-up any Python commands you wish, for yourself (https://docs.python.org/3/index.html). Similarly, any ComSc terms you need to make familiar. Remember that if you open the Python interactive shell, or a REPL, you will be able to quickly experiment with 'new' constructs and ideas!
Thus, counting lines of code (LoC) from my own experiment/proof:
1/ 2 lines
2/ 2 lines
3/ 3 lines as for-loop
4/ 1 or 2 or... lines, depending upon how 'fancy' you'd like the output!
Programmers progress by asking one simple question (which in my case is likely born of an apparent 'laziness'): "surely there's an easier way to do this?". Look at the built-in functions provided by Python, and make use of its power (balanced by ensuring that your code is readable), rather than trying to make it look like C, Java, ... - or per the 'life advice' "listen (read the manuals) before/more than you talk (write the code)"...