Examine the situation and consider what options you have. When your opponent is pretty much just spamming a few moves, the options and the decision-making process are pretty simple and well-defined.
What you know about Ice Blocks is that they move across the ground at a moderate speed, are tangible, do a moderate amount of damage and hitstun, and the Ice Climbers have a lot of lag after using them (which can be mitigated somewhat with desynching). Therefore, your options to beat them are to either jump over them, shield them, break them with an attack, use a platform to avoid them, or allow yourself to get hit by them (with optional crouch-cancel) and immediately act out of it. If you counter their Ice Block somehow, because of the lag the Ice Climbers put themselves in you gain frame advantage. If you're far away this can be used to close space, and if you're close this can be used to attack them.
I know that's incredibly broad, but you can see how you can break down the situation like that (or any situation at all) and find options to use (and then then go on to consider them more deeply, which I'm not doing here). Any of those options will work, but they have their own advantages and disadvantages, and they open themselves up to different counterplay. If your opponent is just spamming one move at one range and another move at another range, then it's easy to avoid the counterplay since you can just choose the options that beat whatever they're doing, and you don't have to worry about them mixing it up (which you'll have to do against better players). The basic concept is doing something which beats the Ice Block, and then using that opportunity to push some sort of advantage. That advantage may just be moving closer, but that puts pressure on your opponent and changes the options available to you. The closer you are the less safe their Ice Blocks are (because you can do more with the lag you have to work with), and the more threatening your attacks/movement are (because your opponent is less able to avoid them on reaction).
F-smash has relatively short range and is laggy. If they're just standing still and using it you can easily dash-dance ("dash-dance" including wavedashing here; e.g. dash in, wavedash back) or shield to bait it out and then punish, especially if they're using it predictably whenever you get close. When you move into the range they feel threatened enough by you to F-smash, they will do it even if you dashsdance out of the way, because they can't react to the dash away to stop themselves by the time they need to throw out the F-smash if you don't. That's part of what dash-dancing is for: to threaten a larger area all at once, because you're ambiguously covering a lot more space within the opponent's reaction window than you would be if you were standing still. Similar principles apply to shielding, and to other options.
The best way to learn this stuff is just to watch videos of good players and see what they do and when, and think about why. The good players have already figured out what's good and what's bad, so you just have to do what they do, more or less. Of course you don't just blindly copy them; you try to understand their decisions so you can implement them in any situation that calls for it, not just the one you saw.
Having a video or a description of more specific situations you're having trouble with would be helpful.